Skip to main content

PimdirAction

Enum PimdirAction 

Source
pub enum PimdirAction {
    Add {
        link_id: Option<ReplicaLinkId>,
        flags: ReplicaFlags,
        object: Option<ReplicaHash>,
        meta: Option<ReplicaMeta>,
        handle: Option<ReplicaHandle>,
    },
    SetFlags {
        seq: i64,
        flags: ReplicaFlags,
    },
    Remove {
        seq: i64,
    },
    Move {
        seq: i64,
        to: ReplicaCollectionId,
    },
    Copy {
        seq: i64,
        to: ReplicaCollectionId,
    },
    Update {
        seq: i64,
        object: ReplicaHash,
        meta: Option<ReplicaMeta>,
    },
    Unknown {
        kind: String,
        payload: String,
        object_hash: Option<ReplicaHash>,
    },
}
Expand description

A queued mutation request (spec §15.3): what a producer appends to the queue table and the owner applies to the store.

The kinds mirror io-replica’s mutation vocabulary on purpose: the queue is the cross-process projection of the engine’s mutate verb. Existing items are addressed by their public seq (spec §9.1), the identifier a reading client already holds, which the owner resolves back to the internal link id.

Variants§

§

Add

Create an item in the collection, staged as a local creation for the sync layer to push. A duplicate live link_id parks the action, the item already existing.

Fields

§link_id: Option<ReplicaLinkId>

The item’s cross-source link id; None derives it from object.

§flags: ReplicaFlags

The initial flag set.

§object: Option<ReplicaHash>

The body’s content hash, matching the row’s object_hash; the producer wrote the blob durably before enqueueing.

§meta: Option<ReplicaMeta>

The item’s summary (spec Annex A), or None when not projected.

§handle: Option<ReplicaHandle>

The provisional handle the create is staged under; None lets the owner derive one.

§

SetFlags

Replace the item’s flag set: absolute, never a delta, so reapplication is idempotent.

Fields

§seq: i64

The item’s public id.

§flags: ReplicaFlags

The new flag set.

§

Remove

Remove the item from the collection; already-absent is success, not an error.

Fields

§seq: i64

The item’s public id.

§

Move

Refile the item into another collection: a target create plus a source removal.

Fields

§seq: i64

The item’s public id.

§to: ReplicaCollectionId

The collection to move it into.

§

Copy

Copy the item into another collection: a move without the removal.

Fields

§seq: i64

The item’s public id.

§to: ReplicaCollectionId

The collection to copy it into.

§

Update

Repoint a mutable-content item’s body (a contact or event edit).

Fields

§seq: i64

The item’s public id.

§object: ReplicaHash

The new body’s content hash; the producer wrote the blob durably before enqueueing.

§meta: Option<ReplicaMeta>

The refreshed summary, or None to keep the cached one.

§

Unknown

An action this crate defines no semantics for: an owner-defined intent, a mail submission, carried by the same queue as the store mutations above.

The store cannot apply it, so its drain skips the row rather than parking it: the action is not unappliable, only unappliable here. An owner that recognises the kind performs it out of band and acknowledges it with drop_action. Only a malformed payload parks.

Fields

§kind: String

The raw queue.action kind.

§payload: String

The raw versioned JSON payload, verbatim: only its owner knows the shape, so nothing here re-encodes it.

§object_hash: Option<ReplicaHash>

The body hash the payload’s object field names, by the same convention as the known kinds, so an intent carrying a body pins it against garbage collection like any other.

Implementations§

Source§

impl PimdirAction

Source

pub fn kind(&self) -> &str

The action kind as its queue.action column value (spec §13).

Source

pub fn object_hash(&self) -> Option<&ReplicaHash>

The body hash the payload references, if any: the value the enqueue carries in queue.object_hash so the pending body is pinned against garbage collection (spec §15.1).

Trait Implementations§

Source§

impl Clone for PimdirAction

Source§

fn clone(&self) -> PimdirAction

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for PimdirAction

Source§

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

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

impl Eq for PimdirAction

Source§

impl PartialEq for PimdirAction

Source§

fn eq(&self, other: &PimdirAction) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PimdirAction

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

type Error = !

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 T
where U: TryFrom<T>,

Source§

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.