forked from hoytech/strfry
-
Notifications
You must be signed in to change notification settings - Fork 3
/
golpe.yaml
133 lines (117 loc) · 4.03 KB
/
golpe.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
appName: strfry
features:
ssl: true
config: true
onAppStartup: true
db: true
customLMDBSetup: true
websockets: true
templar: true
includes: |
#include "PackedEvent.h"
tables:
## DB meta-data. Single entry, with id = 1
Meta:
fields:
- name: dbVersion
- name: endianness
- name: negentropyModificationCounter
## Meta-info of nostr events, suitable for indexing
## Primary key is auto-incremented, called "levId" for Local EVent ID
Event:
opaque: true
indices:
created_at:
integer: true
id:
comparator: StringUint64
pubkey:
comparator: StringUint64
kind:
comparator: Uint64Uint64
pubkeyKind:
comparator: StringUint64Uint64
tag:
comparator: StringUint64
multi: true
deletion: # eventId, pubkey
multi: true
expiration: # unix timestamp, value of 1 is special-case for ephemeral event
integer: true
multi: true
replace: # pubkey, d-tag, kind
multi: true
indexPrelude: |
PackedEventView packed(v.buf);
created_at = packed.created_at();
uint64_t indexTime = *created_at;
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);
packed.foreachTag([&](char tagName, std::string_view tagVal){
tag.push_back(makeKey_StringUint64(std::string(1, tagName) + std::string(tagVal), indexTime));
if (tagName == 'd' && replace.size() == 0) {
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()));
}
return true;
});
if (packed.expiration() != 0) {
expiration.push_back(packed.expiration());
}
CompressionDictionary:
fields:
- name: dict
type: ubytes
NegentropyFilter:
fields:
- name: filter
type: string
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'
config:
- name: db
desc: "Directory that contains the strfry LMDB database"
default: "./strfry-db/"
noReload: true
- name: dbParams__maxreaders
desc: "Maximum number of threads/processes that can simultaneously have LMDB transactions open"
default: 256
noReload: true
- name: dbParams__mapsize
desc: "Size of mmap() to use when loading LMDB (default is 10TB, does *not* correspond to disk-space used)"
default: 10995116277760
noReload: true
- 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
- name: events__maxEventSize
desc: "Maximum size of normalised JSON, in bytes"
default: 65536
- name: events__rejectEventsNewerThanSeconds
desc: "Events newer than this will be rejected"
default: 900 # 15 mins
- name: events__rejectEventsOlderThanSeconds
desc: "Events older than this will be rejected"
default: 94608000 # 3 years
- name: events__rejectEphemeralEventsOlderThanSeconds
desc: "Ephemeral events older than this will be rejected"
default: 60
- name: events__ephemeralEventsLifetimeSeconds
desc: "Ephemeral events will be deleted from the DB when older than this"
default: 300
- name: events__maxNumTags
desc: "Maximum number of tags allowed"
default: 2000
- name: events__maxTagValSize
desc: "Maximum size for tag values, in bytes"
default: 1024