Struct holochain_state::scratch::Scratch
source · [−]pub struct Scratch { /* private fields */ }
Expand description
The “scratch” is an in-memory space to stage Actions to be committed at the end of the CallZome workflow.
This space must also be queryable: specifically, it needs to be combined into queries into the database which return Actions. This is done by a simple filter on the scratch space, and then chaining that iterator onto the iterators over the Actions in the database(s) produced by the Cascade.
Implementations
sourceimpl Scratch
impl Scratch
pub fn new() -> Self
pub fn scheduled_fns(&self) -> &[ScheduledFn]
pub fn add_scheduled_fn(&mut self, scheduled_fn: ScheduledFn)
pub fn chain_top_ordering(&self) -> ChainTopOrdering
pub fn respect_chain_top_ordering(
&mut self,
chain_top_ordering: ChainTopOrdering
)
pub fn add_action(
&mut self,
item: SignedActionHashed,
chain_top_ordering: ChainTopOrdering
)
pub fn chain_head(&self) -> Option<(ActionHash, u32, Timestamp)>
pub fn add_entry(
&mut self,
entry_hashed: EntryHashed,
chain_top_ordering: ChainTopOrdering
)
pub fn as_filter(
&self,
f: impl Fn(&SignedActionHashed) -> bool
) -> FilteredScratch
pub fn into_sync(self) -> SyncScratch
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn actions(&self) -> impl Iterator<Item = &SignedActionHashed>
pub fn records(&self) -> impl Iterator<Item = Record> + '_
sourcepub fn entries(&self) -> impl Iterator<Item = (&EntryHash, &Arc<Entry>)>
pub fn entries(&self) -> impl Iterator<Item = (&EntryHash, &Arc<Entry>)>
Get the entries on in the scratch.
pub fn num_actions(&self) -> usize
pub fn drain_scheduled_fns(&mut self) -> impl Iterator<Item = ScheduledFn> + '_
sourcepub fn drain_actions(&mut self) -> impl Iterator<Item = SignedActionHashed> + '_
pub fn drain_actions(&mut self) -> impl Iterator<Item = SignedActionHashed> + '_
Drain out all the actions.
sourcepub fn drain_entries(&mut self) -> impl Iterator<Item = EntryHashed> + '_
pub fn drain_entries(&mut self) -> impl Iterator<Item = EntryHashed> + '_
Drain out all the entries.
Trait Implementations
sourceimpl Store for Scratch
impl Store for Scratch
It doesn’t make sense to search for
a different authored entry in a scratch
then the scratches author so this is
the same as get_entry
.
It doesn’t make sense to search for
a different authored record in a scratch
then the scratches author so this is
the same as get_record
.
sourcefn get_entry(&self, hash: &EntryHash) -> StateQueryResult<Option<Entry>>
fn get_entry(&self, hash: &EntryHash) -> StateQueryResult<Option<Entry>>
Entry
] from this store.sourcefn contains_entry(&self, hash: &EntryHash) -> StateQueryResult<bool>
fn contains_entry(&self, hash: &EntryHash) -> StateQueryResult<bool>
sourcefn contains_action(&self, hash: &ActionHash) -> StateQueryResult<bool>
fn contains_action(&self, hash: &ActionHash) -> StateQueryResult<bool>
sourcefn get_action(
&self,
hash: &ActionHash
) -> StateQueryResult<Option<SignedActionHashed>>
fn get_action(
&self,
hash: &ActionHash
) -> StateQueryResult<Option<SignedActionHashed>>
SignedActionHashed
] from this store.sourcefn get_record(&self, hash: &AnyDhtHash) -> StateQueryResult<Option<Record>>
fn get_record(&self, hash: &AnyDhtHash) -> StateQueryResult<Option<Record>>
Record
] from this store.sourcefn contains_hash(&self, hash: &AnyDhtHash) -> StateQueryResult<bool>
fn contains_hash(&self, hash: &AnyDhtHash) -> StateQueryResult<bool>
sourceimpl<Q> Stores<Q> for Scratchwhere
Q: Query<Item = Judged<SignedActionHashed>>,
impl<Q> Stores<Q> for Scratchwhere
Q: Query<Item = Judged<SignedActionHashed>>,
type O = FilteredScratch
sourcefn get_initial_data(&self, query: Q) -> StateQueryResult<Self::O>
fn get_initial_data(&self, query: Q) -> StateQueryResult<Self::O>
Auto Trait Implementations
impl RefUnwindSafe for Scratch
impl Send for Scratch
impl Sync for Scratch
impl Unpin for Scratch
impl UnwindSafe for Scratch
Blanket Implementations
impl<T> Any for Twhere
T: Any + ?Sized,
impl<T> Any for Twhere
T: Any + ?Sized,
fn type_id_compat(&self) -> TypeId
fn type_id_compat(&self) -> TypeId
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
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>
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>
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 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 morefn 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.