pub trait ChordStorageInterface {
// Required methods
fn storage_fetch<'life0, 'async_trait>(
&'life0 self,
entry_key: Did,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn storage_store<'life0, 'async_trait>(
&'life0 self,
entry: Entry,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn storage_append_data<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 str,
data: Bytes,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn storage_extend<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 str,
data: Vec<Bytes>,
lifetime_ms: u64,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn storage_tombstone_data<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 str,
data: Bytes,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
}Expand description
ChordStorageInterface should imply necessary method for DHT storage
Element lifetime: every element of a data topic expires at the earlier of its dot’s issue time
plus the element horizon H = EntryKind::Data.max_lifetime_ms() and its topic’s retention
bound, the latest bound any write joined into the topic requested (a plain write requests
EntryKind::Data.default_lifetime_ms(), Self::storage_extend the lifetime its caller
names); writing the value again issues a fresh dot and a fresh bound. A removal covers every
earlier dot of its value, and is collected H + σ after the dot it covers, with
σ = TS_OFFSET_TOLERANCE_MS. The laws are stated in the retention module of dht::entry.
Every remote placement of these operations is rerouted (reroute, #859): a send refused
before backend acceptance is retried from topology recomputed after a topology, link or
capacity event, never after a duration, within REROUTING_BUDGET deferrals; exhaustion
returns Error::ReroutingExhausted with the last cause. A placement is applied at most
once, so append and tombstone keep their non-idempotent semantics.
The placements of one operation run concurrently and all run to completion: an Err
means that at least one placement failed while others may have been applied, and it is an
ambiguous error whenever any placement’s outcome is unknown.
Visibility (#948, #982): Ok means every placement was applied here or has left this node,
not that a remote one was applied. A later fetch resolves each placement again, under the
topology then, and an owner follows each node’s referenced view, which changes on topology
events; the old owner hands the entry off only in a storage repair round. So the store and
the fetch may reach different owners:
store(e) ─▶ X = owner_t₀(p) applies e ── a view changes: owner_t₁(p) = Y ≠ X ──
fetch(k) ─▶ Y = owner_t₁(p) holds nothing ─▶ missThe writer itself observes its write instead: once an operation returns Ok, it is applied
to the writer’s fetch cache as every owner applies it
(ChordStorageCache::local_cache_observe_write), and a fetch answers the join of that
cache and its replies. Law (read-your-writes): if op on k returned Ok at t₀, every
read of k by this node after t₀ contains op’s effect while k stays cached and the
effect is live. Another node reads the write once an owner its lookup reaches holds it.
Read-your-writes is a session guarantee about the writer’s own view, not evidence of
replication: after Ok an owner may still refuse or lose the operation, and the writer
reads it all the same. A caller therefore never takes its own read-back as a publication
check (a registry’s readiness, for one); only an owner’s statement witnesses that it holds
the write: another node’s read, or the store reports of a write made with
ScopedStorage::storage_append_data_reported or ScopedStorage::storage_extend_reported
(#866).
Required Methods§
Sourcefn storage_fetch<'life0, 'async_trait>(
&'life0 self,
entry_key: Did,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn storage_fetch<'life0, 'async_trait>(
&'life0 self,
entry_key: Did,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Fetch an entry from DHT storage.
Sourcefn storage_store<'life0, 'async_trait>(
&'life0 self,
entry: Entry,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn storage_store<'life0, 'async_trait>(
&'life0 self,
entry: Entry,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Store an entry on DHT storage, replacing its payloads (an Overwrite). Each stored
payload expires as the trait documentation states unless it is written again.
Sourcefn storage_append_data<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 str,
data: Bytes,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn storage_append_data<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 str,
data: Bytes,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Append the element data, as its bytes, to a Data kind entry. The element expires as
the trait documentation states unless it is appended again.
Sourcefn storage_extend<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 str,
data: Vec<Bytes>,
lifetime_ms: u64,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn storage_extend<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 str,
data: Vec<Bytes>,
lifetime_ms: u64,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Append the elements data to the Data kind entry of topic as one delta, requesting
the retention bound t + lifetime_ms at the operation boundary t.
The delta is one Extend: its elements share one version (dots (v, 0) … (v, n − 1)),
so one message per placement carries them all. The topic’s bound joins by max, so it
is at least t + lifetime_ms, and each element lives until at least
t + min(H, lifetime_ms) unless removed, capped or evicted, as the trait documentation
states. An owner admits the bound only up to t + EntryKind::Data.max_lifetime_ms() + σ,
as it admits every write, so a longer lifetime is refused, not shortened.
Sourcefn storage_tombstone_data<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 str,
data: Bytes,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn storage_tombstone_data<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 str,
data: Bytes,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Tombstone the observed element data in a Data kind entry: the removal covers every dot
of data the storage owner holds or has held under a later one.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".