11
12
13
14
15
16
17
18
19
20
21
22
23
24
...
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
...
345
346
347
348
349
350
351
352
353
354
355
356
357
358
...
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
...
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
...
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
|
'follow',
'sub', -- get a notification for every post
'mute', -- posts will be completely hidden at all times
'block', -- no interactions will be permitted, but posts will remain visible
'silence', -- messages will not be accepted
'collapse', -- posts will be collapsed by default
'disemvowel', -- posts will be ritually humiliated, but shown
'avoid', -- posts will be kept out of the timeline but will show on users' posts and in conversations
'exclude', -- own posts will not be visible to this user
};
credset = lib.set {
'pw', 'otp', 'challenge', 'trust'
};
privset = lib.set {
................................................................................
owner: uint64
desc: str
folder: str
mime: str
url: str
}
m.user_conf_funcs = function(be,n,ty,rty,rty2)
rty = rty or ty
local gt
if not rty2 -- what the fuck?
then gt = {&m.source, uint64, rawstring} -> rty;
else gt = {&m.source, uint64, rawstring} -> {rty, rty2};
end
for k, t in pairs {
enum = {&m.source, uint64, rawstring} -> lib.mem.ptr(rty);
get = gt;
set = {&m.source, uint64, rawstring, ty} -> {};
reset = {&m.source, uint64, rawstring} -> {};
} do
be.entries[#be.entries+1] = {
field = 'actor_conf_'..n..'_'..k, type = t
}
end
end
................................................................................
comment: str
netmask: m.inet
privs: m.privset
blacklist: bool
}
-- backends only handle content on the local server
struct m.backend { id: rawstring
open: &m.source -> &opaque
close: &m.source -> {}
dbsetup: &m.source -> bool -- creates the schema needed to call conprep (called only once per database e.g. with `parsav db init`)
conprep: {&m.source, m.prepmode.t} -> {} -- prepares queries and similar tasks that require the schema to already be in place
obliterate_everything: &m.source -> bool -- wipes everything parsav-related out of the database
................................................................................
-- these two functions are special, in that they should be called
-- directly on a specific backend, rather than passed down to the
-- backends by the server; that is pathological behavior that will
-- not have the desired effect
server_setup_self: {&m.source, rawstring, lib.mem.ptr(uint8)} -> {}
conf_get: {&m.source, rawstring} -> lib.mem.ptr(int8)
conf_set: {&m.source, rawstring, rawstring} -> {}
conf_reset: {&m.source, rawstring} -> {}
actor_create: {&m.source, &m.actor} -> uint64
actor_save: {&m.source, &m.actor} -> {}
actor_save_privs: {&m.source, &m.actor} -> {}
actor_purge_uid: {&m.source, uint64} -> {}
actor_fetch_xid: {&m.source, lib.mem.ptr(int8)} -> lib.mem.ptr(m.actor)
................................................................................
-- emoji: pstring (null to delete previous reaction, otherwise adds/changes)
post_act_cancel: {&m.source, uint64} -> {}
post_liked_uid: {&m.source, uint64, uint64} -> bool
post_reacted_uid: {&m.source, uint64, uint64} -> bool
post_act_fetch_notice: {&m.source, uint64} -> m.notice
circle_search: {&m.source, &lib.mem.pool, uint64, uint64} -> lib.mem.ptr(m.circle)
circle_create: {&m.source, uint64, pstring} -> {}
circle_destroy: {&m.source, uint64, uint64} -> {}
circle_members_fetch_cid: {&m.source, &lib.mem.pool, uint64, uint64} -> lib.mem.ptr(uint64)
circle_members_fetch_name: {&m.source, &lib.mem.pool, uint64, pstring} -> lib.mem.ptr(uint64)
circle_members_add_uid: {&m.source, uint64, uint64} -> {}
circle_members_del_uid: {&m.source, uint64, uint64} -> {}
thread_latest_arrival_calc: {&m.source, uint64} -> m.timepoint
artifact_instantiate: {&m.source, lib.mem.ptr(uint8), lib.mem.ptr(int8)} -> uint64
-- instantiate an artifact in the database, either installing a new
-- artifact or returning the id of an existing artifact with the same hash
-- artifact: bytea
................................................................................
nkvd_sanction_vacate: {&m.source, uint64} -> {}
nkvd_sanction_enum_target: {&m.source, uint64} -> {}
nkvd_sanction_enum_issuer: {&m.source, uint64} -> {}
nkvd_sanction_review: {&m.source, m.timepoint} -> {}
timeline_actor_fetch_uid: {&m.source, uint64, m.range} -> lib.mem.lstptr(m.post)
timeline_instance_fetch: {&m.source, m.range} -> lib.mem.lstptr(m.post)
}
m.user_conf_funcs(m.backend, 'str', rawstring, lib.mem.ptr(int8))
m.user_conf_funcs(m.backend, 'int', intptr, intptr, bool)
struct m.source {
backend: &m.backend
id: lib.mem.ptr(int8)
handle: &opaque
string: lib.mem.ptr(int8)
}
|
>
|
>
|
|
|
|
>
>
>
>
>
>
<
>
|
|
>
|
|
|
|
>
>
|
|
|
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
...
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
...
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
...
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
...
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
...
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
|
'follow',
'sub', -- get a notification for every post
'mute', -- posts will be completely hidden at all times
'block', -- no interactions will be permitted, but posts will remain visible
'silence', -- messages will not be accepted
'collapse', -- posts will be collapsed by default
'disemvowel', -- posts will be ritually humiliated, but shown
'attenuate', -- user's retweets will not be shown
'avoid', -- posts will be kept out of the timeline but will show on users' posts and in conversations
'exclude', -- own posts will not be visible to this user
};
credset = lib.set {
'pw', 'otp', 'challenge', 'trust'
};
privset = lib.set {
................................................................................
owner: uint64
desc: str
folder: str
mime: str
url: str
}
m.user_conf_funcs = function(be,n,mem,ty,rty,rty2)
rty = rty or ty
local gt
if not mem then
if not rty2 -- what the fuck?
then gt = {&m.source, uint64, lib.str.t} -> rty;
else gt = {&m.source, uint64, lib.str.t} -> {rty, rty2};
end
else
if not rty2 -- what the fuck?
then gt = {&m.source, &lib.mem.pool, uint64, lib.str.t} -> rty;
else gt = {&m.source, &lib.mem.pool, uint64, lib.str.t} -> {rty, rty2};
end
end
for k, t in pairs {
enum = {&m.source, &lib.mem.pool, uint64, lib.str.t} -> lib.mem.ptr(rty);
get = gt;
set = {&m.source, uint64, lib.str.t, ty} -> {};
reset = {&m.source, uint64, lib.str.t} -> {};
} do
be.entries[#be.entries+1] = {
field = 'actor_conf_'..n..'_'..k, type = t
}
end
end
................................................................................
comment: str
netmask: m.inet
privs: m.privset
blacklist: bool
}
-- backends only handle content on the local server
local pstring = lib.str.t
struct m.backend { id: rawstring
open: &m.source -> &opaque
close: &m.source -> {}
dbsetup: &m.source -> bool -- creates the schema needed to call conprep (called only once per database e.g. with `parsav db init`)
conprep: {&m.source, m.prepmode.t} -> {} -- prepares queries and similar tasks that require the schema to already be in place
obliterate_everything: &m.source -> bool -- wipes everything parsav-related out of the database
................................................................................
-- these two functions are special, in that they should be called
-- directly on a specific backend, rather than passed down to the
-- backends by the server; that is pathological behavior that will
-- not have the desired effect
server_setup_self: {&m.source, rawstring, lib.mem.ptr(uint8)} -> {}
conf_get: {&m.source, lib.str.t} -> lib.mem.ptr(int8)
conf_set: {&m.source, lib.str.t, lib.str.t} -> {}
conf_reset: {&m.source, rawstring} -> {}
actor_create: {&m.source, &m.actor} -> uint64
actor_save: {&m.source, &m.actor} -> {}
actor_save_privs: {&m.source, &m.actor} -> {}
actor_purge_uid: {&m.source, uint64} -> {}
actor_fetch_xid: {&m.source, lib.mem.ptr(int8)} -> lib.mem.ptr(m.actor)
................................................................................
-- emoji: pstring (null to delete previous reaction, otherwise adds/changes)
post_act_cancel: {&m.source, uint64} -> {}
post_liked_uid: {&m.source, uint64, uint64} -> bool
post_reacted_uid: {&m.source, uint64, uint64} -> bool
post_act_fetch_notice: {&m.source, uint64} -> m.notice
circle_search: {&m.source, &lib.mem.pool, uint64, uint64} -> lib.mem.ptr(m.circle)
circle_create: {&m.source, uint64, lib.str.t} -> uint64
circle_destroy: {&m.source, uint64, uint64} -> {}
circle_members_fetch_cid: {&m.source, &lib.mem.pool, uint64} -> lib.mem.ptr(uint64)
circle_members_fetch_name: {&m.source, &lib.mem.pool, uint64, pstring} -> lib.mem.ptr(uint64)
circle_members_add_uid: {&m.source, uint64, uint64} -> {}
circle_members_del_uid: {&m.source, uint64, uint64} -> {}
circle_memberships_uid: {&m.source, &lib.mem.pool, uint64, uint64} -> lib.mem.ptr(m.circle)
thread_latest_arrival_calc: {&m.source, uint64} -> m.timepoint
artifact_instantiate: {&m.source, lib.mem.ptr(uint8), lib.mem.ptr(int8)} -> uint64
-- instantiate an artifact in the database, either installing a new
-- artifact or returning the id of an existing artifact with the same hash
-- artifact: bytea
................................................................................
nkvd_sanction_vacate: {&m.source, uint64} -> {}
nkvd_sanction_enum_target: {&m.source, uint64} -> {}
nkvd_sanction_enum_issuer: {&m.source, uint64} -> {}
nkvd_sanction_review: {&m.source, m.timepoint} -> {}
timeline_actor_fetch_uid: {&m.source, uint64, m.range} -> lib.mem.lstptr(m.post)
timeline_instance_fetch: {&m.source, m.range} -> lib.mem.lstptr(m.post)
timeline_circle_fetch: {&m.source, uint64, m.range} -> lib.mem.lstptr(m.post)
}
m.user_conf_funcs(m.backend, 'str', true, lib.str.t, lib.str.t)
m.user_conf_funcs(m.backend, 'int', false, intptr, intptr, bool)
struct m.source {
backend: &m.backend
id: lib.mem.ptr(int8)
handle: &opaque
string: lib.mem.ptr(int8)
}
|