Differences From
Artifact [f53ab94a55]:
1 1 -- vim: ft=terra
2 2 local m = {
3 - timepoint = int64;
3 + timepoint = lib.osclock.time_t;
4 4 scope = lib.enum {
5 5 'public', 'private', 'local';
6 6 'personal', 'direct', 'circle';
7 7 };
8 8 notiftype = lib.enum {
9 9 'mention', 'like', 'rt', 'react'
10 10 };
11 11
12 - relation = lib.enum {
13 - 'follow', 'mute', 'block'
12 + relation = lib.set {
13 + 'silence', -- messages will not be accepted
14 + 'collapse', -- posts will be collapsed by default
15 + 'disemvowel', -- posts will be ritually humiliated, but shown
16 + 'avoid', -- posts will be kept out of the timeline but will show on users' posts and in conversations
17 + 'follow',
18 + 'mute', -- posts will be completely hidden at all times
19 + 'block', -- no interactions will be permitted, but posts will remain visible
14 20 };
15 21 credset = lib.set {
16 22 'pw', 'otp', 'challenge', 'trust'
17 23 };
18 24 privset = lib.set {
19 25 'post', 'edit', 'acct', 'upload', 'censor', 'admin', 'invite'
20 26 };
................................................................................
142 148 id: uint64
143 149 author: uint64
144 150 subject: str
145 151 body: str
146 152 acl: str
147 153 posted: m.timepoint
148 154 discovered: m.timepoint
155 + edited: m.timepoint
156 + chgcount: uint
149 157 mentions: lib.mem.ptr(uint64)
150 158 circles: lib.mem.ptr(uint64) --only meaningful if scope is set to circle
151 159 convoheaduri: str
152 160 parent: uint64
153 161 -- ephemera
154 162 localpost: bool
155 163 source: &m.source
164 +
165 + -- save :: bool -> {} (defined in acl.t due to dep. hell)
156 166 }
157 167
158 168 local cnf = terralib.memoize(function(ty,rty)
159 169 rty = rty or ty
160 170 return struct {
161 171 enum: {&opaque, uint64, rawstring} -> intptr
162 172 get: {&opaque, uint64, rawstring} -> rty
................................................................................
227 237 aid: uint64
228 238 uid: uint64
229 239 aname: str
230 240 netmask: m.inet
231 241 privs: m.privset
232 242 blacklist: bool
233 243 }
244 +
245 +struct m.relationship {
246 + agent: uint64
247 + patient: uint64
248 + rel: m.relation -- agent → patient
249 + recip: m.relation -- patient → agent
250 +}
234 251
235 252 -- backends only handle content on the local server
236 253 struct m.backend { id: rawstring
237 254 open: &m.source -> &opaque
238 255 close: &m.source -> {}
239 256 dbsetup: &m.source -> bool -- creates the schema needed to call conprep (called only once per database e.g. with `parsav db init`)
240 257 conprep: {&m.source, m.prepmode.t} -> {} -- prepares queries and similar tasks that require the schema to already be in place
................................................................................
256 273 actor_save_privs: {&m.source, &m.actor} -> {}
257 274 actor_fetch_xid: {&m.source, lib.mem.ptr(int8)} -> lib.mem.ptr(m.actor)
258 275 actor_fetch_uid: {&m.source, uint64} -> lib.mem.ptr(m.actor)
259 276 actor_notif_fetch_uid: {&m.source, uint64} -> lib.mem.ptr(m.notif)
260 277 actor_enum: {&m.source} -> lib.mem.ptr(&m.actor)
261 278 actor_enum_local: {&m.source} -> lib.mem.ptr(&m.actor)
262 279 actor_stats: {&m.source, uint64} -> m.actor_stats
280 + actor_rel: {&m.source, uint64, uint64} -> m.relationship
263 281
264 282 actor_auth_how: {&m.source, m.inet, rawstring} -> {m.credset, bool}
265 283 -- returns a set of auth method categories that are available for a
266 284 -- given user from a certain origin
267 285 -- origin: inet
268 286 -- username: rawstring
269 287 actor_auth_otp: {&m.source, m.inet, rawstring, rawstring}
................................................................................
283 301 -> {uint64, uint64, pstr}
284 302 -- handles API authentication
285 303 -- origin: inet
286 304 -- handle: rawstring
287 305 -- key: rawstring (X-API-Key)
288 306 actor_auth_record_fetch: {&m.source, uint64} -> lib.mem.ptr(m.auth)
289 307 actor_powers_fetch: {&m.source, uint64} -> m.powerset
290 - actor_session_fetch: {&m.source, uint64, m.inet} -> {lib.stat(m.auth), lib.mem.ptr(m.actor)}
308 + actor_session_fetch: {&m.source, uint64, m.inet, m.timepoint} -> {lib.stat(m.auth), lib.mem.ptr(m.actor)}
291 309 -- retrieves an auth record + actor combo suitable by AID suitable
292 310 -- for determining session validity & caps
293 311 -- aid: uint64
294 312 -- origin: inet
313 + -- cookie issue time: m.timepoint
295 314 actor_auth_register_uid: {&m.source, uint64, uint64} -> {}
296 315 -- notifies the backend module of the UID that has been assigned for
297 316 -- an authentication ID
298 317 -- aid: uint64
299 318 -- uid: uint64
300 319
301 320 actor_conf_str: cnf(rawstring, lib.mem.ptr(int8))
................................................................................
304 323 auth_create_pw: {&m.source, uint64, bool, lib.mem.ptr(int8)} -> {}
305 324 -- uid: uint64
306 325 -- reset: bool (delete other passwords?)
307 326 -- pw: pstring
308 327 auth_purge_pw: {&m.source, uint64, rawstring} -> {}
309 328 auth_purge_otp: {&m.source, uint64, rawstring} -> {}
310 329 auth_purge_trust: {&m.source, uint64, rawstring} -> {}
330 + auth_sigtime_user_fetch: {&m.source, uint64} -> m.timepoint
331 + -- authentication tokens and accounts have a property that controls
332 + -- whether auth cookies dated to a certain point are valid. cookies
333 + -- that are generated before the timepoint are considered invalid.
334 + -- this is used primarily to lock out untrusted sessions.
335 + -- uid: uint64
336 + auth_sigtime_user_alter: {&m.source, uint64, m.timepoint} -> {}
337 + -- uid: uint64
338 + -- timestamp: timepoint
311 339
312 340 post_save: {&m.source, &m.post} -> {}
313 341 post_create: {&m.source, &m.post} -> uint64
342 + post_fetch: {&m.source, uint64} -> lib.mem.ptr(m.post)
314 343 post_enum_author_uid: {&m.source, uint64, m.range} -> lib.mem.ptr(lib.mem.ptr(m.post))
315 344 post_attach_ctl: {&m.source, uint64, uint64, bool} -> {}
316 345 -- attaches or detaches an existing database artifact
317 346 -- post id: uint64
318 347 -- artifact id: uint64
319 348 -- detach: bool
320 349 artifact_instantiate: {&m.source, lib.mem.ptr(uint8), lib.mem.ptr(int8)} -> uint64