pub trait PartitionStore: Send + Sync {
// Required methods
fn put<'life0, 'async_trait>(
&'life0 self,
partition: Partition,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 PartitionId,
) -> Pin<Box<dyn Future<Output = Result<Option<Partition>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Partition>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 PartitionId,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn record_crossing<'life0, 'async_trait>(
&'life0 self,
record: CrossingRecord,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn crossings<'life0, 'life1, 'async_trait>(
&'life0 self,
filter: &'life1 CrossingFilter,
) -> Pin<Box<dyn Future<Output = Result<Vec<CrossingRecord>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn grant<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
run: &'life1 str,
fingerprint: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn grants<'life0, 'life1, 'async_trait>(
&'life0 self,
run: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn release_run<'life0, 'life1, 'async_trait>(
&'life0 self,
run: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
The partition table and the crossing ledger (spec 3.2 §7.8, §13 Q8), on every backend
ProcessStore has: InMemoryPartitionStore,
SqlitePartitionStore, PostgresPartitionStore and RedisPartitionStore, with one
conformance suite (partition_store_conformance_tests!, feature conformance).
§Example
use adk_kernel::{InMemoryPartitionStore, Partition, PartitionId, PartitionStore};
let store = InMemoryPartitionStore::new();
store.put(Partition::new("work", "work")).await?;
assert_eq!(store.get(&PartitionId::new("work")).await?.unwrap().class, "work");
assert_eq!(store.list().await?.len(), 1);Required Methods§
Sourcefn put<'life0, 'async_trait>(
&'life0 self,
partition: Partition,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn put<'life0, 'async_trait>(
&'life0 self,
partition: Partition,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Inserts partition, or replaces the record with the same id.
§Errors
Returns KernelError::Store when the backend fails.
Sourcefn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 PartitionId,
) -> Pin<Box<dyn Future<Output = Result<Option<Partition>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 PartitionId,
) -> Pin<Box<dyn Future<Output = Result<Option<Partition>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Partition>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Partition>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Every partition, ordered by id in byte order.
§Errors
Returns KernelError::Store when the backend fails.
Sourcefn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 PartitionId,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 PartitionId,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Deletes the partition id; false when there was none. Its crossing records stay.
§Errors
Returns KernelError::Store when the backend fails.
Sourcefn record_crossing<'life0, 'async_trait>(
&'life0 self,
record: CrossingRecord,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn record_crossing<'life0, 'async_trait>(
&'life0 self,
record: CrossingRecord,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Appends one crossing record. Records are never changed or deleted.
§Errors
Returns KernelError::Store when the backend fails.
Sourcefn crossings<'life0, 'life1, 'async_trait>(
&'life0 self,
filter: &'life1 CrossingFilter,
) -> Pin<Box<dyn Future<Output = Result<Vec<CrossingRecord>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn crossings<'life0, 'life1, 'async_trait>(
&'life0 self,
filter: &'life1 CrossingFilter,
) -> Pin<Box<dyn Future<Output = Result<Vec<CrossingRecord>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
The crossing records filter selects, ordered by time, then id, at most
filter.limit.
§Errors
Returns KernelError::Store when the backend fails.
Sourcefn grant<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
run: &'life1 str,
fingerprint: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn grant<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
run: &'life1 str,
fingerprint: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Records that the read with crossing-fingerprint digest fingerprint was approved in
the durable run run, for the rest of that run (spec 3.2 §13 Q3). Granting twice
keeps one grant.
§Errors
Returns KernelError::Store when the backend fails.
Sourcefn grants<'life0, 'life1, 'async_trait>(
&'life0 self,
run: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn grants<'life0, 'life1, 'async_trait>(
&'life0 self,
run: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
The fingerprint digests the durable run run holds grants for.
§Errors
Returns KernelError::Store when the backend fails.
Sourcefn release_run<'life0, 'life1, 'async_trait>(
&'life0 self,
run: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn release_run<'life0, 'life1, 'async_trait>(
&'life0 self,
run: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Drops every grant of the durable run run, which finished; answers how many.
§Errors
Returns KernelError::Store when the backend fails.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".