pub struct PostgresStore { /* private fields */ }Expand description
sqlx/Postgres-backed durable event store (clustered tier).
Implementations§
Trait Implementations§
Source§impl Store for PostgresStore
impl Store for PostgresStore
Source§fn usage<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
since: &'life1 str,
until: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<UsageRow>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn usage<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
since: &'life1 str,
until: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<UsageRow>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
The sqlite query’s Postgres twin: same grouping, same filter, same shape.
kind is a TEXT column (not jsonb), so each read casts before
extracting. The explicit ::bigint casts on the counts are load-bearing —
Postgres widens SUM over an integer to numeric, which sqlx will not
decode as i64.
Source§fn append<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 FleetEvent,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn append<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 FleetEvent,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Append one event to durable storage.
Source§fn replay<'life0, 'life1, 'async_trait>(
&'life0 self,
stream_key: &'life1 str,
from_seq: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<FleetEvent>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn replay<'life0, 'life1, 'async_trait>(
&'life0 self,
stream_key: &'life1 str,
from_seq: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<FleetEvent>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Replay events for one stream with
seq >= from_seq, in seq order.Source§fn high_water<'life0, 'life1, 'async_trait>(
&'life0 self,
stream_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn high_water<'life0, 'life1, 'async_trait>(
&'life0 self,
stream_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
The highest
seq ever persisted for stream_key (0 if none). Used to
resume that stream’s sequence counter across daemon restarts.Source§fn writable<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn writable<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Whether the backend can currently accept writes. A cheap, non-destructive
probe used by the readiness endpoint.
Source§fn prune<'life0, 'life1, 'async_trait>(
&'life0 self,
before_ts: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn prune<'life0, 'life1, 'async_trait>(
&'life0 self,
before_ts: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete events with
ts < before_ts (RFC-3339, lexically ordered).
Returns the number removed. Backs age-based retention (#4).Auto Trait Implementations§
impl Freeze for PostgresStore
impl !RefUnwindSafe for PostgresStore
impl Send for PostgresStore
impl Sync for PostgresStore
impl Unpin for PostgresStore
impl UnsafeUnpin for PostgresStore
impl !UnwindSafe for PostgresStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more