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_header(
&self,
zome: Option<Zome>,
header: Header,
maybe_entry: Option<Entry>,
chain_top_ordering: ChainTopOrdering
) -> SourceChainResult<HeaderHash>
pub async fn put_countersigned(
&self,
zome: Option<Zome>,
entry: Entry,
chain_top_ordering: ChainTopOrdering
) -> SourceChainResult<HeaderHash>
pub async fn put<H: HeaderInner, B: HeaderBuilder<H>>(
&self,
zome: Option<Zome>,
header_builder: B,
maybe_entry: Option<Entry>,
chain_top_ordering: ChainTopOrdering
) -> SourceChainResult<HeaderHash>
pub fn flush<'life0, 'life_self, 'async_recursion>(
&'life_self self,
network: &'life0 (dyn HolochainP2pDnaT + Send + Sync)
) -> Pin<Box<dyn Future<Output = SourceChainResult<Vec<(Option<Zome>, SignedHeaderHashed)>>> + 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,
keystore: MetaLairClient,
author: AgentPubKey
) -> SourceChainResult<Self>
sourcepub async fn raw_empty(
vault: AuthorDb,
dht_db: DhtDb,
keystore: MetaLairClient,
author: AgentPubKey
) -> SourceChainResult<Self>
pub async fn raw_empty(
vault: AuthorDb,
dht_db: DhtDb,
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_elements(&self) -> SourceChainResult<Vec<Element>>
pub fn scratch_elements(&self) -> SourceChainResult<Vec<Element>>
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) -> (HeaderHash, u32, Timestamp)
pub fn persisted_chain_head(&self) -> (HeaderHash, 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<(HeaderHash, 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<Element>>
pub async fn query(&self, query: QueryFilter) -> SourceChainResult<Vec<Element>>
Query Headers 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
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<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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
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