2022-12-19 19:42:40 +00:00
|
|
|
appName: strfry
|
2024-07-19 01:28:42 +00:00
|
|
|
features:
|
|
|
|
ssl: true
|
|
|
|
config: true
|
|
|
|
onAppStartup: true
|
|
|
|
db: true
|
|
|
|
customLMDBSetup: true
|
|
|
|
websockets: true
|
2024-07-19 01:35:28 +00:00
|
|
|
templar: true
|
2022-12-19 19:42:40 +00:00
|
|
|
|
2023-01-11 21:23:18 +00:00
|
|
|
includes: |
|
2024-08-30 00:18:05 +00:00
|
|
|
#include "PackedEvent.h"
|
2023-01-11 21:23:18 +00:00
|
|
|
|
2022-12-19 19:42:40 +00:00
|
|
|
tables:
|
2023-01-13 23:54:04 +00:00
|
|
|
## DB meta-data. Single entry, with id = 1
|
|
|
|
Meta:
|
|
|
|
fields:
|
|
|
|
- name: dbVersion
|
|
|
|
- name: endianness
|
2024-09-04 18:15:16 +00:00
|
|
|
- name: negentropyModificationCounter
|
2023-01-13 23:54:04 +00:00
|
|
|
|
2023-01-22 08:22:28 +00:00
|
|
|
## Meta-info of nostr events, suitable for indexing
|
|
|
|
## Primary key is auto-incremented, called "levId" for Local EVent ID
|
2022-12-19 19:42:40 +00:00
|
|
|
Event:
|
2024-08-30 21:39:16 +00:00
|
|
|
opaque: true
|
2022-12-19 19:42:40 +00:00
|
|
|
|
|
|
|
indices:
|
2023-02-09 09:31:31 +00:00
|
|
|
created_at:
|
2023-02-08 21:44:53 +00:00
|
|
|
integer: true
|
2022-12-19 19:42:40 +00:00
|
|
|
id:
|
|
|
|
comparator: StringUint64
|
|
|
|
pubkey:
|
|
|
|
comparator: StringUint64
|
|
|
|
kind:
|
|
|
|
comparator: Uint64Uint64
|
|
|
|
pubkeyKind:
|
|
|
|
comparator: StringUint64Uint64
|
|
|
|
tag:
|
|
|
|
comparator: StringUint64
|
|
|
|
multi: true
|
|
|
|
deletion: # eventId, pubkey
|
|
|
|
multi: true
|
2023-02-25 06:26:27 +00:00
|
|
|
expiration: # unix timestamp, value of 1 is special-case for ephemeral event
|
2023-02-08 11:48:38 +00:00
|
|
|
integer: true
|
|
|
|
multi: true
|
2023-02-08 12:30:14 +00:00
|
|
|
replace: # pubkey, d-tag, kind
|
|
|
|
multi: true
|
2022-12-19 19:42:40 +00:00
|
|
|
|
|
|
|
indexPrelude: |
|
2024-08-30 21:39:16 +00:00
|
|
|
PackedEventView packed(v.buf);
|
2024-08-30 00:18:05 +00:00
|
|
|
created_at = packed.created_at();
|
2023-02-09 09:31:31 +00:00
|
|
|
uint64_t indexTime = *created_at;
|
2022-12-19 19:42:40 +00:00
|
|
|
|
2024-08-30 00:18:05 +00:00
|
|
|
id = makeKey_StringUint64(packed.id(), indexTime);
|
|
|
|
pubkey = makeKey_StringUint64(packed.pubkey(), indexTime);
|
|
|
|
kind = makeKey_Uint64Uint64(packed.kind(), indexTime);
|
|
|
|
pubkeyKind = makeKey_StringUint64Uint64(packed.pubkey(), packed.kind(), indexTime);
|
2023-02-08 12:30:14 +00:00
|
|
|
|
2024-08-30 00:18:05 +00:00
|
|
|
packed.foreachTag([&](char tagName, std::string_view tagVal){
|
2023-01-11 21:23:18 +00:00
|
|
|
tag.push_back(makeKey_StringUint64(std::string(1, tagName) + std::string(tagVal), indexTime));
|
2023-02-08 12:30:14 +00:00
|
|
|
|
|
|
|
if (tagName == 'd' && replace.size() == 0) {
|
2024-08-30 00:18:05 +00:00
|
|
|
replace.push_back(makeKey_StringUint64(std::string(packed.pubkey()) + std::string(tagVal), packed.kind()));
|
|
|
|
} else if (tagName == 'e' && packed.kind() == 5) {
|
|
|
|
deletion.push_back(std::string(tagVal) + std::string(packed.pubkey()));
|
2023-02-08 12:30:14 +00:00
|
|
|
}
|
2023-01-11 21:23:18 +00:00
|
|
|
|
2024-08-30 00:18:05 +00:00
|
|
|
return true;
|
|
|
|
});
|
2022-12-19 19:42:40 +00:00
|
|
|
|
2024-08-30 00:18:05 +00:00
|
|
|
if (packed.expiration() != 0) {
|
|
|
|
expiration.push_back(packed.expiration());
|
2023-02-08 11:48:38 +00:00
|
|
|
}
|
|
|
|
|
2023-01-22 08:22:28 +00:00
|
|
|
CompressionDictionary:
|
|
|
|
fields:
|
|
|
|
- name: dict
|
|
|
|
type: ubytes
|
|
|
|
|
2024-09-04 18:15:16 +00:00
|
|
|
NegentropyFilter:
|
|
|
|
fields:
|
|
|
|
- name: filter
|
|
|
|
type: string
|
|
|
|
|
2023-01-22 08:22:28 +00:00
|
|
|
tablesRaw:
|
|
|
|
## Raw nostr event JSON, possibly compressed
|
|
|
|
## keys are levIds
|
|
|
|
## vals are prefixed with a type byte:
|
|
|
|
## 0: no compression, payload follows
|
|
|
|
## 1: zstd compression. Followed by Dictionary ID (native endian uint32) then compressed payload
|
|
|
|
EventPayload:
|
|
|
|
flags: 'MDB_INTEGERKEY'
|
|
|
|
|
2022-12-19 19:42:40 +00:00
|
|
|
config:
|
|
|
|
- name: db
|
2023-02-02 20:18:18 +00:00
|
|
|
desc: "Directory that contains the strfry LMDB database"
|
2022-12-19 19:42:40 +00:00
|
|
|
default: "./strfry-db/"
|
|
|
|
noReload: true
|
|
|
|
|
2023-02-02 20:18:18 +00:00
|
|
|
- name: dbParams__maxreaders
|
|
|
|
desc: "Maximum number of threads/processes that can simultaneously have LMDB transactions open"
|
|
|
|
default: 256
|
|
|
|
noReload: true
|
|
|
|
- name: dbParams__mapsize
|
2023-02-07 19:00:21 +00:00
|
|
|
desc: "Size of mmap() to use when loading LMDB (default is 10TB, does *not* correspond to disk-space used)"
|
2023-02-02 20:18:18 +00:00
|
|
|
default: 10995116277760
|
|
|
|
noReload: true
|
2023-08-10 20:33:18 +00:00
|
|
|
- name: dbParams__noReadAhead
|
|
|
|
desc: "Disables read-ahead when accessing the LMDB mapping. Reduces IO activity when DB size is larger than RAM."
|
|
|
|
default: false
|
|
|
|
noReload: true
|
2023-02-02 20:18:18 +00:00
|
|
|
|
2023-01-13 21:14:11 +00:00
|
|
|
- name: events__maxEventSize
|
|
|
|
desc: "Maximum size of normalised JSON, in bytes"
|
|
|
|
default: 65536
|
2022-12-19 19:42:40 +00:00
|
|
|
- name: events__rejectEventsNewerThanSeconds
|
2023-01-13 21:14:11 +00:00
|
|
|
desc: "Events newer than this will be rejected"
|
2022-12-19 19:42:40 +00:00
|
|
|
default: 900 # 15 mins
|
|
|
|
- name: events__rejectEventsOlderThanSeconds
|
2023-01-13 21:14:11 +00:00
|
|
|
desc: "Events older than this will be rejected"
|
|
|
|
default: 94608000 # 3 years
|
2022-12-19 19:42:40 +00:00
|
|
|
- name: events__rejectEphemeralEventsOlderThanSeconds
|
2023-01-13 21:14:11 +00:00
|
|
|
desc: "Ephemeral events older than this will be rejected"
|
2022-12-19 19:42:40 +00:00
|
|
|
default: 60
|
|
|
|
- name: events__ephemeralEventsLifetimeSeconds
|
2023-01-13 21:14:11 +00:00
|
|
|
desc: "Ephemeral events will be deleted from the DB when older than this"
|
2022-12-19 19:42:40 +00:00
|
|
|
default: 300
|
|
|
|
- name: events__maxNumTags
|
2023-01-13 21:14:11 +00:00
|
|
|
desc: "Maximum number of tags allowed"
|
2023-02-05 06:50:26 +00:00
|
|
|
default: 2000
|
2022-12-19 19:42:40 +00:00
|
|
|
- name: events__maxTagValSize
|
2023-01-13 21:14:11 +00:00
|
|
|
desc: "Maximum size for tag values, in bytes"
|
2023-02-05 06:50:26 +00:00
|
|
|
default: 1024
|