pub struct Tenancy { /* private fields */ }Expand description
The tenancy store: one SQLite connection, serialised behind a mutex.
Lookups are one indexed query per request, trivial next to the whole-graph load every query already performs. WAL mode plus a busy timeout keeps the file shareable, matching the key store.
Implementations§
Source§impl Tenancy
impl Tenancy
Sourcepub fn open(path: &Path) -> Result<Self, ApiError>
pub fn open(path: &Path) -> Result<Self, ApiError>
Opens (creating if needed) the tenancy store at path.
Sourcepub fn record(
&self,
index_id: &str,
owner_key_id: &str,
created_at: i64,
expires_at: Option<i64>,
) -> Result<(), ApiError>
pub fn record( &self, index_id: &str, owner_key_id: &str, created_at: i64, expires_at: Option<i64>, ) -> Result<(), ApiError>
Records index_id as owned by owner_key_id, created at
created_at (Unix seconds) and expiring at expires_at if given.
Sourcepub fn lookup(&self, index_id: &str) -> Result<Option<IndexRecord>, ApiError>
pub fn lookup(&self, index_id: &str) -> Result<Option<IndexRecord>, ApiError>
The ownership record for index_id, or None for a legacy index.
Sourcepub fn count_active_for_owner(
&self,
owner_key_id: &str,
now: i64,
) -> Result<usize, ApiError>
pub fn count_active_for_owner( &self, owner_key_id: &str, now: i64, ) -> Result<usize, ApiError>
How many indexes owner_key_id actively holds at now:
records it owns whose expiry has not passed. An expired
record does not count — it is refused on access and pruned
on sight, so a key is never charged quota for an index it
can no longer read (paid-path S3’s active-index quota reads
this number).
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Tenancy
impl RefUnwindSafe for Tenancy
impl Send for Tenancy
impl Sync for Tenancy
impl Unpin for Tenancy
impl UnsafeUnpin for Tenancy
impl UnwindSafe for Tenancy
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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> ⓘ
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> ⓘ
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