notedeck icon indicating copy to clipboard operation
notedeck copied to clipboard

subman API

Open ksedgwic opened this issue 11 months ago • 13 comments

ksedgwic avatar Dec 09 '24 23:12 ksedgwic

I bet we could make the SubEndpoint a scoped object which automatically unsubscribes when it is dropped ...

ksedgwic avatar Dec 10 '24 00:12 ksedgwic

I'm missing the outer flow on outbox ... is this right?:

  1. user clicks to view thread
  2. we one-time fetch k:10002 for author and determine authors relays
  3. we subscribe to the thread with SubConstraint::OutboxRelays(author_relays)
  4. SubMgr evaluates relays, possibly changes current set
  5. user disposes of thread view, we remove subscription (and reevaluate relays)

OutboxRelays means "make sure we have at least one of these in our active set"

ksedgwic avatar Dec 10 '24 01:12 ksedgwic

It might be useful to have a SubConstraint::Local which only queries local and doesn't alter remote subscriptions

ksedgwic avatar Dec 10 '24 01:12 ksedgwic

liking the sounds of this so far!

jb55 avatar Dec 10 '24 01:12 jb55

  • I force pushed the first commit, cleaning up the compiler comments etc
  • the second commit makes the SubReceiver (was SubEndpoint) scoped and unsubscribes when it goes out scope.

Is the second commit a good thing? I used an Arc<Mutex<SubMgr>> to calm rust re: the SubMgr reference issues ...

ksedgwic avatar Dec 10 '24 23:12 ksedgwic

Renamed to subman

ksedgwic avatar Feb 12 '25 18:02 ksedgwic

rebased on master

ksedgwic avatar Feb 27 '25 00:02 ksedgwic

not sure what these errors mean:

unknown_id_send: remote:f9a6ae99-0e26-4a21-9d09-d767309943a5: error: InternalError("trouble reading from rx_ended")

jb55 avatar Mar 01 '25 01:03 jb55

not sure what these errors mean:

good catch, that is not really an error, changed it to:

             match rsub.rx_ended.next().await {
-                Some(_) => Err(SubError::StreamEnded),
-                None => Err(SubError::InternalError(
-                    "trouble reading from rx_ended".to_string(),
-                )),
+                // in both cases the stream has ended
+                Some(_) => Err(SubError::StreamEnded), // an EOSE was observed
+                None => Err(SubError::StreamEnded),    // the subscription was closed
             }

ksedgwic avatar Mar 04 '25 18:03 ksedgwic

@jb55 i added some error handling and relay pool handling improvements in the last three commits

ksedgwic avatar Mar 04 '25 18:03 ksedgwic

rebased on master

ksedgwic avatar Mar 04 '25 22:03 ksedgwic

rebased on master

ksedgwic avatar Mar 10 '25 19:03 ksedgwic

why don't timelines use SubMan? https://github.com/ksedgwic/notedeck/blob/f1aec8f6a21e89a7b4b97ebcdf1b6fa9389282df/crates/notedeck_columns/src/timeline/mod.rs#L581

kernelkind avatar Mar 26 '25 20:03 kernelkind