diff options
author | polwex <polwex@sortug.com> | 2025-09-17 21:45:18 +0700 |
---|---|---|
committer | polwex <polwex@sortug.com> | 2025-09-17 21:45:18 +0700 |
commit | 985fa2f7c99832cdf3c3351d2273c8fd05402b78 (patch) | |
tree | bc727486a89ad05e588754f8de8b1096400a3d31 /desk/lib/trill/feed.hoon | |
parent | f0df4c7297a05bd592d8717b8997284c80fd0500 (diff) |
basic comms working
Diffstat (limited to 'desk/lib/trill/feed.hoon')
-rw-r--r-- | desk/lib/trill/feed.hoon | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/desk/lib/trill/feed.hoon b/desk/lib/trill/feed.hoon index c21feb3..721a596 100644 --- a/desk/lib/trill/feed.hoon +++ b/desk/lib/trill/feed.hoon @@ -1,14 +1,16 @@ -/- feed=trill-feed, sur=nostrill +/- feed=trill-feed, post=trill-post, sur=nostrill /+ sr=sortug, constants |% -++ latest-page |= f=feed:feed ^- fc:feed +++ latest-page +=/ count feed-page-size:constants +|= f=feed:feed ^- fc:feed =/ nodelist (tap:orm:feed f) - =/ subset (scag feed-page-size:constants nodelist) + =/ subset (scag count nodelist) ?~ subset [f ~ ~] - =/ start `id.i.subset + =/ start `-.i.subset =/ rev (flop subset) ?~ rev [f ~ ~] - =/ end `id.i.rev + =/ end `-.i.rev =/ nf (gas:orm:feed *feed:feed subset) [nf start end] :: @@ -16,20 +18,20 @@ =/ nodelist (tap:norm:sur f) =/ subset (scag feed-page-size:constants nodelist) ?~ subset [f ~ ~] - =/ start `id.i.subset + =/ start (some `@da`-.i.subset) =/ rev (flop subset) ?~ rev [f ~ ~] - =/ end `id.i.rev + =/ end (some `@da`-.i.rev) =/ nf (gas:norm:sur *nostr-feed:sur subset) [nf start end] :: :: NOTE START IS OLD, END IS NEW ++ subset +=/ count feed-page-size:constants |= [=fc:feed replies=? now=@da] ^- fc:feed ?: ?&(?=(%~ start.fc) ?=(%~ end.fc)) (latest-page feed.fc) - =/ count feed-page-size:constants =/ start ?~ start.fc 0 u.start.fc =/ end ?~ end.fc now u.end.fc =/ nodelist (tap:orm:feed feed.fc) @@ -43,9 +45,26 @@ == ?& (lte id start) (gte id end) == =/ thread-count (lent threads) - =/ result=(list [id:post post:post]) ?: newest (scag count threads) (flop (scag count (flop threads))) + :: TODO I remember something was weird about this + :: =/ result=(list [id:post post:post]) ?: newest (scag count threads) (flop (scag count (flop threads))) + =/ result=(list [id:post post:post]) (scag count threads) =/ cursors=[(unit @da) (unit @da)] ?~ result [~ ~] ?~ threads [~ ~] :- ?: .=((head result) (head threads)) ~ `id:(head result) ?: .=((rear result) (rear threads)) ~ `id:(rear result) [(gas:orm:feed *feed:feed result) -.cursors +.cursors] +:: posts +++ node-to-full +|= [p=post:post f=feed:feed] ^- full-node:post + p(children (convert-children children.p f)) +++ convert-children +|= [children=(set id:post) f=feed:feed] + ^- internal-graph:post + =/ g=full-graph:post %- ~(rep in children) + |= [=id:post acc=full-graph:post] + =/ n (get:orm:feed f id) + ?~ n acc + =/ full-node (node-to-full u.n f) + (put:form:post acc id full-node) + ?~ children [%empty ~] + :- %full g -- |