diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2024-10-01 22:43:18 -0400 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2024-10-01 23:14:49 -0400 |
| commit | d171a258ad2119e39cb715f8800031fff16967dc (patch) | |
| tree | 453cf4c65fa18ff98ef13d9730f1a0f74ff68540 /src/repo/channel.rs | |
| parent | b8392a5fe824eff46f912a58885546e7b0f37e6f (diff) | |
Provide a resume point to bridge clients from state snapshots to the event sequence.
Diffstat (limited to 'src/repo/channel.rs')
| -rw-r--r-- | src/repo/channel.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/repo/channel.rs b/src/repo/channel.rs index efc2ced..ad42710 100644 --- a/src/repo/channel.rs +++ b/src/repo/channel.rs @@ -82,7 +82,10 @@ impl<'c> Channels<'c> { Ok(channel) } - pub async fn all(&mut self) -> Result<Vec<Channel>, sqlx::Error> { + pub async fn all( + &mut self, + resume_point: Option<Sequence>, + ) -> Result<Vec<Channel>, sqlx::Error> { let channels = sqlx::query_as!( Channel, r#" @@ -92,8 +95,10 @@ impl<'c> Channels<'c> { created_at as "created_at: DateTime", created_sequence as "created_sequence: Sequence" from channel + where coalesce(created_sequence <= $1, true) order by channel.name "#, + resume_point, ) .fetch_all(&mut *self.0) .await?; |
