Struct holochain_state::source_chain::SourceChain
source · [−]pub struct SourceChain<AuthorDb = DbWrite<DbKindAuthored>, DhtDb = DbWrite<DbKindDht>> { /* private fields */ }
Implementations
sourceimpl SourceChain
impl SourceChain
Writable functions for a source chain with write access.
pub async fn unlock_chain(&self) -> SourceChainResult<()>
pub async fn accept_countersigning_preflight_request(
&self,
preflight_request: PreflightRequest,
agent_index: u8
) -> SourceChainResult<CounterSigningAgentState>
pub async fn put_with_action(
&self,
action: Action,
maybe_entry: Option<Entry>,
chain_top_ordering: ChainTopOrdering
) -> SourceChainResult<ActionHash>
pub async fn put_countersigned(
&self,
entry: Entry,
chain_top_ordering: ChainTopOrdering,
weight: EntryRateWeight
) -> SourceChainResult<ActionHash>
sourcepub async fn put<U: ActionUnweighed<Weight = ()>, B: ActionBuilder<U>>(
&self,
action_builder: B,
maybe_entry: Option<Entry>,
chain_top_ordering: ChainTopOrdering
) -> SourceChainResult<ActionHash>
pub async fn put<U: ActionUnweighed<Weight = ()>, B: ActionBuilder<U>>(
&self,
action_builder: B,
maybe_entry: Option<Entry>,
chain_top_ordering: ChainTopOrdering
) -> SourceChainResult<ActionHash>
Put a new record at the end of the source chain, using a ActionBuilder
for an action type which has no weight data.
If needing to put
an action with weight data, use
SourceChain::put_weighed
instead.
sourcepub async fn put_weighed<W, U: ActionUnweighed<Weight = W>, B: ActionBuilder<U>>(
&self,
action_builder: B,
maybe_entry: Option<Entry>,
chain_top_ordering: ChainTopOrdering,
weight: W
) -> SourceChainResult<ActionHash>
pub async fn put_weighed<W, U: ActionUnweighed<Weight = W>, B: ActionBuilder<U>>(
&self,
action_builder: B,
maybe_entry: Option<Entry>,
chain_top_ordering: ChainTopOrdering,
weight: W
) -> SourceChainResult<ActionHash>
Put a new record at the end of the source chain, using a ActionBuilder and the specified weight for rate limiting.
pub async fn put_weightless<W: Default, U: ActionUnweighed<Weight = W>, B: ActionBuilder<U>>(
&self,
action_builder: B,
maybe_entry: Option<Entry>,
chain_top_ordering: ChainTopOrdering
) -> SourceChainResult<ActionHash>
pub fn flush<'life0, 'life_self, 'async_recursion>(
&'life_self self,
network: &'life0 (dyn HolochainP2pDnaT + Send + Sync)
) -> Pin<Box<dyn Future<Output = SourceChainResult<Vec<SignedActionHashed>>> + Send + 'async_recursion>> where
'life0: 'async_recursion,
'life_self: 'async_recursion,
sourceimpl<AuthorDb, DhtDb> SourceChain<AuthorDb, DhtDb> where
AuthorDb: ReadAccess<DbKindAuthored>,
DhtDb: ReadAccess<DbKindDht>,
impl<AuthorDb, DhtDb> SourceChain<AuthorDb, DhtDb> where
AuthorDb: ReadAccess<DbKindAuthored>,
DhtDb: ReadAccess<DbKindDht>,
pub async fn new(
vault: AuthorDb,
dht_db: DhtDb,
dht_db_cache: DhtDbQueryCache,
keystore: MetaLairClient,
author: AgentPubKey
) -> SourceChainResult<Self>
sourcepub async fn raw_empty(
vault: AuthorDb,
dht_db: DhtDb,
dht_db_cache: DhtDbQueryCache,
keystore: MetaLairClient,
author: AgentPubKey
) -> SourceChainResult<Self>
pub async fn raw_empty(
vault: AuthorDb,
dht_db: DhtDb,
dht_db_cache: DhtDbQueryCache,
keystore: MetaLairClient,
author: AgentPubKey
) -> SourceChainResult<Self>
Create a source chain with a blank chain head. You probably don’t want this. This type is only useful for when a source chain really needs to be constructed before genesis runs.
pub fn public_only(&mut self)
pub fn keystore(&self) -> &MetaLairClient
sourcepub fn snapshot(&self) -> SourceChainResult<Scratch>
pub fn snapshot(&self) -> SourceChainResult<Scratch>
Take a snapshot of the scratch space that will not remain in sync with future updates.
pub fn scratch(&self) -> SyncScratch
pub fn agent_pubkey(&self) -> &AgentPubKey
pub fn to_agent_pubkey(&self) -> Arc<AgentPubKey>
pub fn cell_id(&self) -> CellId
sourcepub fn scratch_records(&self) -> SourceChainResult<Vec<Record>>
pub fn scratch_records(&self) -> SourceChainResult<Vec<Record>>
This has to clone all the data because we can’t return references to constructed data.
pub fn has_initialized(&self) -> SourceChainResult<bool>
pub fn is_empty(&self) -> SourceChainResult<bool>
sourcepub fn persisted_chain_head(&self) -> (ActionHash, u32, Timestamp)
pub fn persisted_chain_head(&self) -> (ActionHash, u32, Timestamp)
Accessor for the chain head that will be used at flush time to check the “as at” for ordering integrity etc.
pub fn chain_head(&self) -> SourceChainResult<(ActionHash, u32, Timestamp)>
pub fn len(&self) -> SourceChainResult<u32>
pub async fn valid_cap_grant(
&self,
check_function: GrantedFunction,
check_agent: AgentPubKey,
check_secret: Option<CapSecret>
) -> SourceChainResult<Option<CapGrant>>
sourcepub async fn query(&self, query: QueryFilter) -> SourceChainResult<Vec<Record>>
pub async fn query(&self, query: QueryFilter) -> SourceChainResult<Vec<Record>>
Query Actions in the source chain.
This returns a Vec rather than an iterator because it is intended to be
used by the query
host function, which crosses the wasm boundary
pub async fn is_chain_locked(&self, lock: Vec<u8>) -> SourceChainResult<bool>
sourcepub fn countersigning_op(&self) -> SourceChainResult<Option<DhtOp>>
pub fn countersigning_op(&self) -> SourceChainResult<Option<DhtOp>>
If there is a countersigning session get the StoreEntry op to send to the entry authorities.
Trait Implementations
sourceimpl<AuthorDb: Clone, DhtDb: Clone> Clone for SourceChain<AuthorDb, DhtDb>
impl<AuthorDb: Clone, DhtDb: Clone> Clone for SourceChain<AuthorDb, DhtDb>
sourcefn clone(&self) -> SourceChain<AuthorDb, DhtDb>
fn clone(&self) -> SourceChain<AuthorDb, DhtDb>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl From<SourceChain<DbWrite<DbKindAuthored>, DbWrite<DbKindDht>>> for SourceChainRead
impl From<SourceChain<DbWrite<DbKindAuthored>, DbWrite<DbKindDht>>> for SourceChainRead
sourcefn from(chain: SourceChain) -> Self
fn from(chain: SourceChain) -> Self
Converts to this type from the input type.
Auto Trait Implementations
impl<AuthorDb = DbWrite<DbKindAuthored>, DhtDb = DbWrite<DbKindDht>> !RefUnwindSafe for SourceChain<AuthorDb, DhtDb>
impl<AuthorDb, DhtDb> Send for SourceChain<AuthorDb, DhtDb> where
AuthorDb: Send,
DhtDb: Send,
impl<AuthorDb, DhtDb> Sync for SourceChain<AuthorDb, DhtDb> where
AuthorDb: Sync,
DhtDb: Sync,
impl<AuthorDb, DhtDb> Unpin for SourceChain<AuthorDb, DhtDb> where
AuthorDb: Unpin,
DhtDb: Unpin,
impl<AuthorDb = DbWrite<DbKindAuthored>, DhtDb = DbWrite<DbKindDht>> !UnwindSafe for SourceChain<AuthorDb, DhtDb>
Blanket Implementations
impl<T> Any for T where
T: Any + ?Sized,
impl<T> Any for T where
T: Any + ?Sized,
fn type_id_compat(&self) -> TypeId
fn type_id_compat(&self) -> TypeId
TODO: once 1.33.0 is the minimum supported compiler version, remove Any::type_id_compat and use StdAny::type_id instead. https://github.com/rust-lang/rust/issues/27745 Read more
impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<F, W, T, D> Deserialize<With<T, W>, D> for F where
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for F where
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
Deserializes using the given deserializer
impl<T> FutureExt for T
impl<T> FutureExt for T
fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more