Logo Mibo

ChangeableMap<'K, 'V> Type

A changeable map: the writable source of an adaptive map. Reads and writes are confined to the owner thread. See ChangeableSet<'T> for the transaction and view contracts.

Constructors

Constructor Description

ChangeableMap(initial)

Full Usage: ChangeableMap(initial)

Parameters:
    initial : ('K * 'V) seq

Returns: ChangeableMap<'K, 'V>
initial : ('K * 'V) seq
Returns: ChangeableMap<'K, 'V>

Instance members

Instance member Description

this.AddOrUpdate

Full Usage: this.AddOrUpdate

Parameters:
    key : 'K
    valueToSet : 'V

Adds or updates an entry. No-op when the value is unchanged.

key : 'K
valueToSet : 'V

this.PostAddOrUpdate

Full Usage: this.PostAddOrUpdate

Parameters:
    key : 'K
    valueToSet : 'V

Posts an add or update. Safe from any thread: the operation is queued and returns immediately. The owner thread applies the queued operations at the next graph operation (reads and writes auto-drain) or at Posting.pump, as one batch: one net delta, one notification delivery, and a burst is coalesced into a single handoff.

key : 'K
valueToSet : 'V
Example

 // worker thread
 CMap.postAddOrUpdate key value map
 // owner thread: the next read applies the post automatically
 let view = AMap.force map
val view: obj

this.PostClear

Full Usage: this.PostClear

Posts a clear (a full replace with the empty map). Safe from any thread. See PostAddOrUpdate for the application contract.

Example

 // worker thread
 CMap.postClear map

this.PostRemove

Full Usage: this.PostRemove

Parameters:
    key : 'K

Posts a remove. Safe from any thread. See PostAddOrUpdate for the application contract.

key : 'K
Example

 // worker thread
 CMap.postRemove key map

this.PostSet

Full Usage: this.PostSet

Parameters:
    newValue : ('K * 'V) seq

Posts a full replace. Safe from any thread. See PostAddOrUpdate for the application contract; a posted replace supersedes the other ops of the same pending batch (the transaction semantics of Set).

newValue : ('K * 'V) seq
Example

 // worker thread
 CMap.postSet (Map.toSeq (Map.ofList [ 1, "a" ])) map
Multiple items
module Map from Microsoft.FSharp.Collections

--------------------
type Map<'Key,'Value (requires comparison)> = interface IReadOnlyDictionary<'Key,'Value> interface IReadOnlyCollection<KeyValuePair<'Key,'Value>> interface IEnumerable interface IStructuralEquatable interface IComparable interface IEnumerable<KeyValuePair<'Key,'Value>> interface ICollection<KeyValuePair<'Key,'Value>> interface IDictionary<'Key,'Value> new: elements: ('Key * 'Value) seq -> Map<'Key,'Value> member Add: key: 'Key * value: 'Value -> Map<'Key,'Value> ...

--------------------
new: elements: ('Key * 'Value) seq -> Map<'Key,'Value>
val toSeq: table: Map<'Key,'T> -> ('Key * 'T) seq (requires comparison)
val ofList: elements: ('Key * 'T) list -> Map<'Key,'T> (requires comparison)

this.Remove

Full Usage: this.Remove

Parameters:
    key : 'K

Removes an entry. No-op when absent.

key : 'K

this.Set

Full Usage: this.Set

Parameters:
    newValue : ('K * 'V) seq

Replaces the whole map. Supersedes the whole batch inside a
 transaction (later writes of the batch are discarded; matches the
 list, docs/ALIST-DESIGN.md ยง3.3).
newValue : ('K * 'V) seq

Type something to start searching.