parsav  Diff

Differences From Artifact [8e00371af1]:

To Artifact [0871cb7e85]:


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