Struct ditto::register::Register [] [src]

pub struct Register<T: Clone> { /* fields omitted */ }

A Register is a replaceable value that can be updated via the update function.

Register allows op-based replication via execute_op and state-based replication via merge. Both replication methods are idempotent and can handle out-of-order delivery.

Register has a spatial complexity of O(N + S), where N is the number of values concurrently held in the Register and S is the number of sites that have updated the Register. It has the following performance characteristics:

  • update: O(1)
  • execute_op: O(N), where N is the number of values concurrently held in the Register.
  • merge: O(N + M), where N and M are the number of values concurrently held in the Register being merged into and the RegisterState being merged, respectively.

Methods

impl<T: Clone> Register<T>
[src]

[src]

Constructs and returns a new Register with site id 1.

[src]

Returns a reference to the Register's value.

[src]

Updates the Register's value and returns an op that can be replciated to other sites. If the register does not have a site id allocated, it caches the op and returns an AwaitingSiteId error.

[src]

Executes an Op and returns a reference to the new value if the value has changed. If the op has already been executed or superceded, nothing is done.

[src]

Merges remote state into the Register

[src]

Assigns a site id and returns a cached op if it exists.

[src]

Returns the Register's site id.

[src]

Returns a reference to the Register's summary.

[src]

Returns a borrowed RegisterState.

[src]

Returns an owned RegisterState of cloned values.

[src]

Consumes the Register and returns its RegisterState

[src]

Constructs a new Register from a RegisterState and an optional site id. If the site id is given, it must be nonzero.

[src]

Validates that an op comes from a specific site id, then executes the op.

Trait Implementations

impl<T: Debug + Clone> Debug for Register<T>
[src]

[src]

Formats the value using the given formatter. Read more

impl<T: Clone + Clone> Clone for Register<T>
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<T: PartialEq + Clone> PartialEq for Register<T>
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

Auto Trait Implementations

impl<T> Send for Register<T> where
    T: Send

impl<T> Sync for Register<T> where
    T: Sync