···
45
45
global: PartitionHandle,
46
46
}
47
47
48
48
-
/**
49
49
-
* new data format, roughly:
50
50
-
*
51
51
-
* Partion: 'global'
52
52
-
*
53
53
-
* - Global sequence counter (is the jetstream cursor -- monotonic with many gaps)
54
54
-
* key: "js_cursor" (literal)
55
55
-
* val: u64
56
56
-
*
57
57
-
* - Jetstream server endpoint (persisted because the cursor can't be used on another instance without data loss)
58
58
-
* key: "js_endpoint" (literal)
59
59
-
* val: string (URL of the instance)
60
60
-
*
61
61
-
* - Launch date
62
62
-
* key: "takeoff" (literal)
63
63
-
* val: u64 (micros timestamp, not from jetstream for now so not precise)
64
64
-
*
65
65
-
* - Rollup cursor (bg work: roll stats into hourlies, delete accounts, old record deletes)
66
66
-
* key: "rollup_cursor" (literal)
67
67
-
* val: u64 (tracks behind js_cursor)
68
68
-
*
69
69
-
*
70
70
-
* Partition: 'feed'
71
71
-
*
72
72
-
* - Per-collection list of record references ordered by jetstream cursor
73
73
-
* key: nullstr || u64 (collection nsid null-terminated, jetstream cursor)
74
74
-
* val: nullstr || nullstr || nullstr (did, rkey, rev. rev is mostly a sanity-check for now.)
75
75
-
*
76
76
-
*
77
77
-
* Partition: 'records'
78
78
-
*
79
79
-
* - Actual records by their atproto location
80
80
-
* key: nullstr || nullstr || nullstr (did, collection, rkey)
81
81
-
* val: u64 || bool || nullstr || rawval (js_cursor, is_update, rev, actual record)
82
82
-
*
83
83
-
*
84
84
-
* Partition: 'rollups'
85
85
-
*
86
86
-
* - Live (batched) records counts and dids estimate per collection
87
87
-
* key: "live_counts" || u64 || nullstr (js_cursor, nsid)
88
88
-
* val: u64 || HLL (count (not cursor), estimator)
89
89
-
*
90
90
-
* - Hourly total record counts and dids estimate per collection
91
91
-
* key: "hourly_counts" || u64 || nullstr (hour, nsid)
92
92
-
* val: u64 || HLL (count (not cursor), estimator)
93
93
-
*
94
94
-
* - Weekly total record counts and dids estimate per collection
95
95
-
* key: "weekly_counts" || u64 || nullstr (hour, nsid)
96
96
-
* val: u64 || HLL (count (not cursor), estimator)
97
97
-
*
98
98
-
* - All-time total record counts and dids estimate per collection
99
99
-
* key: "ever_counts" || nullstr (nsid)
100
100
-
* val: u64 || HLL (count (not cursor), estimator)
101
101
-
*
102
102
-
* - TODO: sorted indexes for all-times?
103
103
-
*
104
104
-
*
105
105
-
* Partition: 'queues'
106
106
-
*
107
107
-
* - Delete account queue
108
108
-
* key: "delete_acount" || u64 (js_cursor)
109
109
-
* val: nullstr (did)
110
110
-
*
111
111
-
*
112
112
-
* TODO: moderation actions
113
113
-
* TODO: account privacy preferences. Might wait for the protocol-level (PDS-level?) stuff to land. Will probably do lazy fetching + caching on read.
114
114
-
**/
48
48
+
///
49
49
+
/// new data format, roughly:
50
50
+
///
51
51
+
/// Partion: 'global'
52
52
+
///
53
53
+
/// - Global sequence counter (is the jetstream cursor -- monotonic with many gaps)
54
54
+
/// key: "js_cursor" (literal)
55
55
+
/// val: u64
56
56
+
///
57
57
+
/// - Jetstream server endpoint (persisted because the cursor can't be used on another instance without data loss)
58
58
+
/// key: "js_endpoint" (literal)
59
59
+
/// val: string (URL of the instance)
60
60
+
///
61
61
+
/// - Launch date
62
62
+
/// key: "takeoff" (literal)
63
63
+
/// val: u64 (micros timestamp, not from jetstream for now so not precise)
64
64
+
///
65
65
+
/// - Rollup cursor (bg work: roll stats into hourlies, delete accounts, old record deletes)
66
66
+
/// key: "rollup_cursor" (literal)
67
67
+
/// val: u64 (tracks behind js_cursor)
68
68
+
///
69
69
+
///
70
70
+
/// Partition: 'feed'
71
71
+
///
72
72
+
/// - Per-collection list of record references ordered by jetstream cursor
73
73
+
/// key: nullstr || u64 (collection nsid null-terminated, jetstream cursor)
74
74
+
/// val: nullstr || nullstr || nullstr (did, rkey, rev. rev is mostly a sanity-check for now.)
75
75
+
///
76
76
+
///
77
77
+
/// Partition: 'records'
78
78
+
///
79
79
+
/// - Actual records by their atproto location
80
80
+
/// key: nullstr || nullstr || nullstr (did, collection, rkey)
81
81
+
/// val: u64 || bool || nullstr || rawval (js_cursor, is_update, rev, actual record)
82
82
+
///
83
83
+
///
84
84
+
/// Partition: 'rollups'
85
85
+
///
86
86
+
/// - Live (batched) records counts and dids estimate per collection
87
87
+
/// key: "live_counts" || u64 || nullstr (js_cursor, nsid)
88
88
+
/// val: u64 || HLL (count (not cursor), estimator)
89
89
+
///
90
90
+
/// - Hourly total record counts and dids estimate per collection
91
91
+
/// key: "hourly_counts" || u64 || nullstr (hour, nsid)
92
92
+
/// val: u64 || HLL (count (not cursor), estimator)
93
93
+
///
94
94
+
/// - Weekly total record counts and dids estimate per collection
95
95
+
/// key: "weekly_counts" || u64 || nullstr (hour, nsid)
96
96
+
/// val: u64 || HLL (count (not cursor), estimator)
97
97
+
///
98
98
+
/// - All-time total record counts and dids estimate per collection
99
99
+
/// key: "ever_counts" || nullstr (nsid)
100
100
+
/// val: u64 || HLL (count (not cursor), estimator)
101
101
+
///
102
102
+
/// - TODO: sorted indexes for all-times?
103
103
+
///
104
104
+
///
105
105
+
/// Partition: 'queues'
106
106
+
///
107
107
+
/// - Delete account queue
108
108
+
/// key: "delete_acount" || u64 (js_cursor)
109
109
+
/// val: nullstr (did)
110
110
+
///
111
111
+
///
112
112
+
/// TODO: moderation actions
113
113
+
/// TODO: account privacy preferences. Might wait for the protocol-level (PDS-level?) stuff to land. Will probably do lazy fetching + caching on read.
115
114
#[derive(Debug)]
116
115
pub struct FjallStorage {}
117
116