Struct holochain_state::source_chain::SourceChain
source · pub struct SourceChain<AuthorDb = DbWrite<DbKindAuthored>, DhtDb = DbWrite<DbKindDht>> { /* private fields */ }
Implementations§
source§impl 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,
source§impl<AuthorDb, DhtDb> SourceChain<AuthorDb, DhtDb>
impl<AuthorDb, DhtDb> SourceChain<AuthorDb, DhtDb>
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 async fn zomes_initialized(&self) -> SourceChainResult<bool>
pub fn set_zomes_initialized(&self, value: bool)
pub fn is_empty(&self) -> SourceChainResult<bool>
sourcepub fn persisted_head_info(&self) -> Option<HeadInfo>
pub fn persisted_head_info(&self) -> Option<HeadInfo>
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<Option<HeadInfo>>
pub fn chain_head_nonempty(&self) -> SourceChainResult<HeadInfo>
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§
source§impl<AuthorDb: Clone, DhtDb: Clone> Clone for SourceChain<AuthorDb, DhtDb>
impl<AuthorDb: Clone, DhtDb: Clone> Clone for SourceChain<AuthorDb, DhtDb>
source§fn clone(&self) -> SourceChain<AuthorDb, DhtDb>
fn clone(&self) -> SourceChain<AuthorDb, DhtDb>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl From<SourceChain> for SourceChainRead
impl From<SourceChain> for SourceChainRead
source§fn from(chain: SourceChain) -> Self
fn from(chain: SourceChain) -> Self
Auto Trait Implementations§
impl<AuthorDb = DbWrite<DbKindAuthored>, DhtDb = DbWrite<DbKindDht>> !RefUnwindSafe for SourceChain<AuthorDb, DhtDb>
impl<AuthorDb, DhtDb> Send for SourceChain<AuthorDb, DhtDb>
impl<AuthorDb, DhtDb> Sync for SourceChain<AuthorDb, DhtDb>
impl<AuthorDb, DhtDb> Unpin for SourceChain<AuthorDb, DhtDb>
impl<AuthorDb = DbWrite<DbKindAuthored>, DhtDb = DbWrite<DbKindDht>> !UnwindSafe for SourceChain<AuthorDb, DhtDb>
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata
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<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
§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>
§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>
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> 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>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.