A proxy to access Shared Maps from application code.
- Source:
Extends
Members
$
- Source:
A context containing proxies to all the visible Shared Maps for this CA.
Application code refers to these maps using aliases:
this.$.sharing.$.myMap
and this is typically shortened as follows:
const $$ = this.$.sharing.$
$$.myMap.set('x', $$.myMap.get('y') + 1)
Methods
addReadOnlyMap(alias, name, optionsopt)
- Source:
Creates a read-only mirror of a Shared Map or an Aggregate Map.
The Shared Map will be active before this CA processes another message.
The consistency model is monotonic read consistency: local replicas could be stale, but once we see a Shared Map version, we will never see previous ones.
Type of caf_map.options is {isAggregate: boolean}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
alias |
string | A short name that identifies this map in the
|
|
name |
string | A fully qualified name for the source of this
Shared Map, i.e., scoped
with the owner's CA name, like |
|
options |
mapOptionsType |
<optional> |
If |
addWritableMap(alias, name, optionsopt)
- Source:
Creates, or reloads if already created, a writable Shared Map.
The map will be active before this CA processes another message.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
alias |
string | A short name that identifies this map in the
|
|
name |
string | A relative name for this map that will be scoped by this CA's name. |
|
options |
mapOptionsType |
<optional> |
With field |
applyDelta(alias, changes, loggeropt)
- Source:
Applies a change set to a writable map, needed to replicate external Shared Maps.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
alias |
string | The local alias for this map. |
|
changes |
mapUpdateType | A set of changes to apply. |
|
logger |
Object |
<optional> |
An optional logger,
i.e., |
Throws:
Error when the change set version is not compatible.
deleteMap(alias)
- Source:
Deletes a local reference to a Shared Map.
The contents of the map are not destroyed from persistent storage.
Parameters:
Name | Type | Description |
---|---|---|
alias |
string | The local alias for this map. |
fullName(name) → {string}
- Source:
Gets the full name of a local writable Shared Map.
Maps are named after the CA that owns them, i.e., a complete name is
caOwner-caLocalName-mapLocalName
.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | A relative name for a Shared Map. |
Returns:
A complete name for the Shared Map.
- Type
- string
pullUpdate(alias, versionopt) → {mapUpdateType|Array.<mapUpdateType>}
- Source:
Returns an incremental update or a full dump of the Shared Map.
The type of mapUpdateType
is {version: number, remove : Array<string>, add : Array<string|Object>}
where add
just flattens key/value pairs in a single array.
Multiple incremental updates can be provided in an array of
mapUpdateType
objects.
An up to date local replica will have an empty array as update.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
alias |
string | The local alias for this map. |
|
version |
number |
<optional> |
The current version of the local Shared Map, or
|
Returns:
A full dump of the map or a list with incremental updates (empty if up to date).
- Type
- mapUpdateType | Array.<mapUpdateType>