Skip to content

HashCKeyspace[K: Any val, V: (Convergent[V] ref & Replicated ref), H: HashFunction[K] val]

[Source]

A keyed collection of convergent CRDTs sharing a causal context. Each key maps to an instance of V, created on demand via at. All values share the same DotContext, enabling coordinated causal tracking across keys.

Convergence merges entries key-by-key, creating local entries for keys that exist only in the remote state.

class ref HashCKeyspace[K: Any val, V: (Convergent[V] ref & Replicated ref), H: HashFunction[K] val]

Constructors

create

[Source]

new ref create(
  id: ID)
: HashCKeyspace[K, V, H] ref^

Parameters

Returns


Public Functions

is_empty

[Source]

fun box is_empty()
: Bool val

Returns


size

[Source]

fun box size()
: USize val

Returns


keys

[Source]

fun box keys()
: Iterator[this->K] ref^

Returns


values

[Source]

fun box values()
: Iterator[this->V] ref^

Returns


pairs

[Source]

fun box pairs()
: Iterator[(this->K , this->V)] ref^

Returns


apply

[Source]

fun box apply(
  k: box->K!)
: this->V ?

Parameters

  • k: box->K!

Returns

  • this->V ?

at

[Source]

fun ref at(
  k: box->K!)
: V

Parameters

  • k: box->K!

Returns

  • V

converge

[Source]

Merge state from that keyspace into this one. Returns true if the convergence added new information.

fun ref converge(
  that: HashCKeyspace[K, V, H] box)
: Bool val

Parameters

Returns


string

[Source]

Return a best effort at printing the map. If K and V are Stringable, use string representations of them; otherwise print them as question marks.

fun box string()
: String iso^

Returns


from_tokens

[Source]

Deserialize an instance of this data structure from a stream of tokens.

fun ref from_tokens(
  that: TokensIterator ref)
: None val ?

Parameters

Returns


each_token

[Source]

Serialize the data structure, capturing each token into the given Tokens.

fun ref each_token(
  tokens: Tokens ref)
: None val

Parameters

Returns


each_token_of_history

[Source]

Serialize the causal history, capturing each token into the given Tokens.

fun box each_token_of_history(
  tokens: Tokens ref)
: None val

Parameters

Returns


compare_history_with_tokens

[Source]

Compare the causal context with that represented by the given token stream. Raises an error if the tokens couldn't be parsed as a causal context. Returns two boolean values, representing differences that are present. The first return value is true if this context has dots missing in that one. The other return value is true if that context has dots missing in this one.

fun box compare_history_with_tokens(
  that: TokensIterator ref)
: (Bool val , Bool val) ?

Parameters

Returns