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§

source§

impl Scratch

source

pub fn new() -> Self

source

pub fn scheduled_fns(&self) -> &[ScheduledFn]

source

pub fn add_scheduled_fn(&mut self, scheduled_fn: ScheduledFn)

source

pub fn chain_top_ordering(&self) -> ChainTopOrdering

source

pub fn respect_chain_top_ordering( &mut self, chain_top_ordering: ChainTopOrdering )

source

pub fn add_action( &mut self, item: SignedActionHashed, chain_top_ordering: ChainTopOrdering )

source

pub fn chain_head(&self) -> Option<HeadInfo>

source

pub fn add_entry( &mut self, entry_hashed: EntryHashed, chain_top_ordering: ChainTopOrdering )

source

pub fn as_filter( &self, f: impl Fn(&SignedActionHashed) -> bool ) -> FilteredScratch

source

pub fn into_sync(self) -> SyncScratch

source

pub fn len(&self) -> usize

source

pub fn is_empty(&self) -> bool

source

pub fn actions(&self) -> impl Iterator<Item = &SignedActionHashed>

source

pub fn records(&self) -> impl Iterator<Item = Record> + '_

source

pub fn entries(&self) -> impl Iterator<Item = (&EntryHash, &Arc<Entry>)>

Get the entries on in the scratch.

source

pub fn num_actions(&self) -> usize

source

pub fn drain_scheduled_fns(&mut self) -> impl Iterator<Item = ScheduledFn> + '_

source

pub fn drain_actions(&mut self) -> impl Iterator<Item = SignedActionHashed> + '_

Drain out all the actions.

source

pub fn drain_entries(&mut self) -> impl Iterator<Item = EntryHashed> + '_

Drain out all the entries.

Trait Implementations§

source§

impl Clone for Scratch

source§

fn clone(&self) -> Scratch

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Scratch

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Scratch

source§

fn default() -> Scratch

Returns the “default value” for a type. Read more
source§

impl Store for Scratch

source§

fn get_public_or_authored_entry( &self, hash: &EntryHash, _author: Option<&AgentPubKey> ) -> StateQueryResult<Option<Entry>>

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.

source§

fn get_public_or_authored_record( &self, hash: &AnyDhtHash, _author: Option<&AgentPubKey> ) -> StateQueryResult<Option<Record>>

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.

source§

fn get_entry(&self, hash: &EntryHash) -> StateQueryResult<Option<Entry>>

Get an [Entry] from this store.
source§

fn contains_entry(&self, hash: &EntryHash) -> StateQueryResult<bool>

Check if an entry is contained in the store
source§

fn contains_action(&self, hash: &ActionHash) -> StateQueryResult<bool>

Check if an action is contained in the store
source§

fn get_action( &self, hash: &ActionHash ) -> StateQueryResult<Option<SignedActionHashed>>

Get an [SignedActionHashed] from this store.
source§

fn get_record(&self, hash: &AnyDhtHash) -> StateQueryResult<Option<Record>>

Get an [Record] from this store.
source§

fn contains_hash(&self, hash: &AnyDhtHash) -> StateQueryResult<bool>

Check if a hash is contained in the store
source§

impl<Q> Stores<Q> for Scratchwhere Q: Query<Item = Judged<SignedActionHashed>>,

§

type O = FilteredScratch

source§

fn get_initial_data(&self, query: Q) -> StateQueryResult<Self::O>

Gets the raw initial data from the database, needed to begin the query.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Any for Twhere T: Any,

§

fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>

§

fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>

§

fn type_name(&self) -> &'static str

§

impl<T> AnySync for Twhere T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T, Global>) -> Arc<dyn Any + Sync + Send, Global>

§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

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 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>

Deserializes using the given deserializer
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,

§

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

Checks if self is actually part of its subset T (and can be converted to it).
§

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

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcastable for Twhere T: Any + Send + Sync + 'static,

§

fn upcast_any_ref(&self) -> &(dyn Any + 'static)

upcast ref
§

fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)

upcast mut ref
§

fn upcast_any_box(self: Box<T, Global>) -> Box<dyn Any, Global>

upcast boxed dyn
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> State for Twhere T: Debug + Clone + Send + Sync,