This is a fairly large rewrite which unifies our threads, timelines and profiles. Now all timelines have a MultiSubscriber, and can be added and removed to columns just like Threads and Profiles. Signed-off-by: William Casarin <jb55@jb55.com>
33 lines
889 B
Rust
33 lines
889 B
Rust
use crate::timeline::TimelineKind;
|
|
use std::collections::HashMap;
|
|
use uuid::Uuid;
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub enum SubKind {
|
|
/// Initial subscription. This is the first time we do a remote subscription
|
|
/// for a timeline
|
|
Initial,
|
|
|
|
/// One shot requests, we can just close after we receive EOSE
|
|
OneShot,
|
|
|
|
Timeline(TimelineKind),
|
|
|
|
/// We are fetching a contact list so that we can use it for our follows
|
|
/// Filter.
|
|
// TODO: generalize this to any list?
|
|
FetchingContactList(TimelineKind),
|
|
}
|
|
|
|
/// Subscriptions that need to be tracked at various stages. Sometimes we
|
|
/// need to do A, then B, then C. Tracking requests at various stages by
|
|
/// mapping uuid subids to explicit states happens here.
|
|
#[derive(Default)]
|
|
pub struct Subscriptions {
|
|
pub subs: HashMap<String, SubKind>,
|
|
}
|
|
|
|
pub fn new_sub_id() -> String {
|
|
Uuid::new_v4().to_string()
|
|
}
|