API documentation of Agoric SDK / Exports / @agoric/store / index
Module: index
Table of contents
Variables
Functions
- assertKey
- assertPattern
- assertScalarKey
- bagCompare
- bagDisjointSubtract
- bagIntersection
- bagIsSuperbag
- bagUnion
- coerceToBagEntries
- coerceToElements
- compareKeys
- defineExoClass
- defineExoClassKit
- elementsCompare
- elementsDisjointSubtract
- elementsDisjointUnion
- elementsIntersection
- elementsIsDisjoint
- elementsIsSuperset
- elementsUnion
- getCopyBagEntries
- getCopyMapEntries
- getCopySetKeys
- getRankCover
- initEmpty
- isCopyMap
- isCopySet
- isKey
- isPattern
- keyEQ
- keyGT
- keyGTE
- keyLT
- keyLTE
- makeCopyBag
- makeCopyBagFromElements
- makeCopyMap
- makeCopySet
- makeExo
- makeLegacyMap
- makeLegacyWeakMap
- makeScalarMapStore
- makeScalarSetStore
- makeScalarWeakMapStore
- makeScalarWeakSetStore
- matches
- mustMatch
- provideLazy
- setCompare
- setDisjointSubtract
- setDisjointUnion
- setIntersection
- setIsDisjoint
- setIsSuperset
- setUnion
Variables
M
• Const
M: MatcherNamespace
Defined in
node_modules/@endo/patterns/src/patterns/patternMatchers.d.ts:18
Functions
assertKey
▸ assertKey(val
): void
Parameters
Name | Type |
---|---|
val | any |
Returns
void
Defined in
node_modules/@endo/patterns/src/keys/checkKey.d.ts:8
assertPattern
▸ assertPattern(patt
): void
Parameters
Name | Type |
---|---|
patt | any |
Returns
void
Defined in
node_modules/@endo/patterns/src/patterns/patternMatchers.d.ts:15
assertScalarKey
▸ assertScalarKey(val
): void
Parameters
Name | Type |
---|---|
val | any |
Returns
void
Defined in
node_modules/@endo/patterns/src/keys/checkKey.d.ts:5
bagCompare
▸ bagCompare<K
>(left
, right
): number
Type parameters
Name |
---|
K |
Parameters
Name | Type |
---|---|
left | CopyBag <K > |
right | CopyBag <K > |
Returns
number
Defined in
node_modules/@endo/patterns/src/keys/compareKeys.d.ts:2
bagDisjointSubtract
▸ bagDisjointSubtract(xbag
, ybag
): CopyBag
Parameters
Name | Type |
---|---|
xbag | any |
ybag | any |
Returns
CopyBag
Defined in
node_modules/@endo/patterns/src/keys/merge-bag-operators.d.ts:5
bagIntersection
▸ bagIntersection(xbag
, ybag
): CopyBag
Parameters
Name | Type |
---|---|
xbag | any |
ybag | any |
Returns
CopyBag
Defined in
node_modules/@endo/patterns/src/keys/merge-bag-operators.d.ts:4
bagIsSuperbag
▸ bagIsSuperbag(xbag
, ybag
): any
Parameters
Name | Type |
---|---|
xbag | any |
ybag | any |
Returns
any
Defined in
node_modules/@endo/patterns/src/keys/merge-bag-operators.d.ts:1
bagUnion
▸ bagUnion(xbag
, ybag
): CopyBag
Parameters
Name | Type |
---|---|
xbag | any |
ybag | any |
Returns
CopyBag
Defined in
node_modules/@endo/patterns/src/keys/merge-bag-operators.d.ts:3
coerceToBagEntries
▸ coerceToBagEntries(bagEntriesList
): [any
, bigint
][]
Parameters
Name | Type |
---|---|
bagEntriesList | any |
Returns
[any
, bigint
][]
Defined in
node_modules/@endo/patterns/src/keys/copyBag.d.ts:4
coerceToElements
▸ coerceToElements(elementsList
): any
[]
Parameters
Name | Type |
---|---|
elementsList | any |
Returns
any
[]
Defined in
node_modules/@endo/patterns/src/keys/copySet.d.ts:4
compareKeys
▸ compareKeys(left
, right
): number
Parameters
Name | Type |
---|---|
left | any |
right | any |
Returns
number
Defined in
node_modules/@endo/patterns/src/keys/compareKeys.d.ts:4
defineExoClass
▸ defineExoClass<I
, M
>(tag
, interfaceGuard
, init
, methods
, options?
): (...args
: Parameters
<I
>) => Guarded
<M
>
Type parameters
Name | Type |
---|---|
I | extends (...args : any []) => any |
M | extends Methods |
Parameters
Name | Type |
---|---|
tag | string |
interfaceGuard | undefined | InterfaceGuard <{ [K in string | number | symbol]: MethodGuard }> |
init | I |
methods | M & ThisType <{ self : Guarded <M > ; state : ReturnType <I > }> |
options? | FarClassOptions <ClassContext <S , M >, any > |
Returns
fn
▸ (...args
): Guarded
<M
>
Parameters
Name | Type |
---|---|
...args | Parameters <I > |
Returns
Guarded
<M
>
Defined in
node_modules/@endo/exo/src/exo-makers.d.ts:2
defineExoClassKit
▸ defineExoClassKit<I
, F
>(tag
, interfaceGuardKit
, init
, methodsKit
, options?
): (...args
: Parameters
<I
>) => GuardedKit
<F
>
Type parameters
Name | Type |
---|---|
I | extends (...args : any []) => any |
F | extends Record <string , Methods > |
Parameters
Name | Type |
---|---|
tag | string |
interfaceGuardKit | undefined | { [K in string | number | symbol]: InterfaceGuard<{ [M in string | number | symbol]: MethodGuard }> } |
init | I |
methodsKit | F & { [K_1 in string | number | symbol]: ThisType<Object> } |
options? | FarClassOptions <KitContext <S , F >, GuardedKit <F >> |
Returns
fn
▸ (...args
): GuardedKit
<F
>
Parameters
Name | Type |
---|---|
...args | Parameters <I > |
Returns
GuardedKit
<F
>
Defined in
node_modules/@endo/exo/src/exo-makers.d.ts:6
elementsCompare
▸ elementsCompare(xelements
, yelements
): any
Parameters
Name | Type |
---|---|
xelements | any |
yelements | any |
Returns
any
Defined in
node_modules/@endo/patterns/src/keys/merge-set-operators.d.ts:3
elementsDisjointSubtract
▸ elementsDisjointSubtract(xelements
, yelements
): any
Parameters
Name | Type |
---|---|
xelements | any |
yelements | any |
Returns
any
Defined in
node_modules/@endo/patterns/src/keys/merge-set-operators.d.ts:7
elementsDisjointUnion
▸ elementsDisjointUnion(xelements
, yelements
): any
Parameters
Name | Type |
---|---|
xelements | any |
yelements | any |
Returns
any
Defined in
node_modules/@endo/patterns/src/keys/merge-set-operators.d.ts:5
elementsIntersection
▸ elementsIntersection(xelements
, yelements
): any
Parameters
Name | Type |
---|---|
xelements | any |
yelements | any |
Returns
any
Defined in
node_modules/@endo/patterns/src/keys/merge-set-operators.d.ts:6
elementsIsDisjoint
▸ elementsIsDisjoint(xelements
, yelements
): any
Parameters
Name | Type |
---|---|
xelements | any |
yelements | any |
Returns
any
Defined in
node_modules/@endo/patterns/src/keys/merge-set-operators.d.ts:2
elementsIsSuperset
▸ elementsIsSuperset(xelements
, yelements
): any
Parameters
Name | Type |
---|---|
xelements | any |
yelements | any |
Returns
any
Defined in
node_modules/@endo/patterns/src/keys/merge-set-operators.d.ts:1
elementsUnion
▸ elementsUnion(xelements
, yelements
): any
Parameters
Name | Type |
---|---|
xelements | any |
yelements | any |
Returns
any
Defined in
node_modules/@endo/patterns/src/keys/merge-set-operators.d.ts:4
getCopyBagEntries
▸ getCopyBagEntries<K
>(b
): [K
, bigint
][]
Type parameters
Name |
---|
K |
Parameters
Name | Type |
---|---|
b | CopyBag <K > |
Returns
[K
, bigint
][]
Defined in
node_modules/@endo/patterns/src/keys/checkKey.d.ts:42
getCopyMapEntries
▸ getCopyMapEntries<K
, V
>(m
): Iterable
<[K
, V
]>
Type parameters
Name | Type |
---|---|
K | extends unknown |
V | extends unknown |
Parameters
Name | Type |
---|---|
m | CopyMap <K , V > |
Returns
Iterable
<[K
, V
]>
Defined in
node_modules/@endo/patterns/src/keys/checkKey.d.ts:64
getCopySetKeys
▸ getCopySetKeys<K
>(s
): K
[]
Type parameters
Name |
---|
K |
Parameters
Name | Type |
---|---|
s | CopySet <K > |
Returns
K
[]
Defined in
node_modules/@endo/patterns/src/keys/checkKey.d.ts:24
getRankCover
▸ getRankCover(payload
, encodePassable
): RankCover
Parameters
Name | Type |
---|---|
payload | any |
encodePassable | KeyToDBKey |
Returns
RankCover
Defined in
node_modules/@endo/patterns/src/patterns/patternMatchers.d.ts:17
initEmpty
▸ initEmpty(): Object
Returns
Object
Defined in
node_modules/@endo/exo/src/exo-makers.d.ts:1
isCopyMap
▸ isCopyMap(m
): m is CopyMap<any, any>
Parameters
Name | Type |
---|---|
m | any |
Returns
m is CopyMap<any, any>
Defined in
node_modules/@endo/patterns/src/keys/checkKey.d.ts:53
isCopySet
▸ isCopySet(s
): s is CopySet<any>
Parameters
Name | Type |
---|---|
s | any |
Returns
s is CopySet<any>
Defined in
node_modules/@endo/patterns/src/keys/checkKey.d.ts:16
isKey
▸ isKey(val
): boolean
Parameters
Name | Type |
---|---|
val | any |
Returns
boolean
Defined in
node_modules/@endo/patterns/src/keys/checkKey.d.ts:7
isPattern
▸ isPattern(patt
): boolean
Parameters
Name | Type |
---|---|
patt | any |
Returns
boolean
Defined in
node_modules/@endo/patterns/src/patterns/patternMatchers.d.ts:16
keyEQ
▸ keyEQ(left
, right
): boolean
Parameters
Name | Type |
---|---|
left | any |
right | any |
Returns
boolean
Defined in
node_modules/@endo/patterns/src/keys/compareKeys.d.ts:7
keyGT
▸ keyGT(left
, right
): boolean
Parameters
Name | Type |
---|---|
left | any |
right | any |
Returns
boolean
Defined in
node_modules/@endo/patterns/src/keys/compareKeys.d.ts:9
keyGTE
▸ keyGTE(left
, right
): boolean
Parameters
Name | Type |
---|---|
left | any |
right | any |
Returns
boolean
Defined in
node_modules/@endo/patterns/src/keys/compareKeys.d.ts:8
keyLT
▸ keyLT(left
, right
): boolean
Parameters
Name | Type |
---|---|
left | any |
right | any |
Returns
boolean
Defined in
node_modules/@endo/patterns/src/keys/compareKeys.d.ts:5
keyLTE
▸ keyLTE(left
, right
): boolean
Parameters
Name | Type |
---|---|
left | any |
right | any |
Returns
boolean
Defined in
node_modules/@endo/patterns/src/keys/compareKeys.d.ts:6
makeCopyBag
▸ makeCopyBag<K
>(bagEntryIter
): CopyBag
<K
>
Type parameters
Name |
---|
K |
Parameters
Name | Type |
---|---|
bagEntryIter | Iterable <[K , bigint ]> |
Returns
CopyBag
<K
>
Defined in
node_modules/@endo/patterns/src/keys/checkKey.d.ts:44
makeCopyBagFromElements
▸ makeCopyBagFromElements<K
>(elementIter
): CopyBag
<K
>
Type parameters
Name |
---|
K |
Parameters
Name | Type |
---|---|
elementIter | Iterable <K > |
Returns
CopyBag
<K
>
Defined in
node_modules/@endo/patterns/src/keys/checkKey.d.ts:45
makeCopyMap
▸ makeCopyMap<K
, V
>(entries
): CopyMap
<K
, V
>
Type parameters
Name | Type |
---|---|
K | extends unknown |
V | extends unknown |
Parameters
Name | Type |
---|---|
entries | Iterable <[K , V ]> |
Returns
CopyMap
<K
, V
>
Defined in
node_modules/@endo/patterns/src/keys/checkKey.d.ts:68
makeCopySet
▸ makeCopySet<K
>(elementIter
): CopySet
<K
>
Type parameters
Name |
---|
K |
Parameters
Name | Type |
---|---|
elementIter | Iterable <K > |
Returns
CopySet
<K
>
Defined in
node_modules/@endo/patterns/src/keys/checkKey.d.ts:26
makeExo
▸ makeExo<T
>(tag
, interfaceGuard
, methods
, options?
): Guarded
<T
>
Type parameters
Name | Type |
---|---|
T | extends Methods |
Parameters
Name | Type |
---|---|
tag | string |
interfaceGuard | undefined | InterfaceGuard <{ [M in string | number | symbol]: MethodGuard }> |
methods | T |
options? | FarClassOptions <ClassContext <S , M >, any > |
Returns
Guarded
<T
>
Defined in
node_modules/@endo/exo/src/exo-makers.d.ts:10
makeLegacyMap
▸ makeLegacyMap<K
, V
>(tag?
): LegacyMap
<K
, V
>
This module and its fraternal sibling legacyWeakMap exist only to ease a transition to the modern store
system, are deprecated, and will eventually disappear. They are needed for now to support some of the uses of the old behavior that are not compatible with the new. The constraint imposed by the new is that only passables can be used as values, and only keys (roughly, structures, aka comparables) can be used as values.
See https://github.com/Agoric/agoric-sdk/pull/3567
TODO Once that PR is merged, link to the documents rather than the PRs.
Each of these non-conforming uses should be marked with a
// Legacy because...
comment explaining the problem inhibiting conversion to the new system. Some of these problems as of this writing:
- A promiseKit used as a value, even though a promiseKit is not a passable. Solutions are to make it a passable, or to convert the container back to a conventional JavaScript Map.
- A mutable array used as a value, that is subsequently mutated. Freezing the array wouldn't work of course because it would break the subsequent mutation. Using a far object wrapping an array would likely work fine.
Type parameters
Name |
---|
K |
V |
Parameters
Name | Type | Default value | Description |
---|---|---|---|
tag? | string | 'key' | tag for debugging |
Returns
LegacyMap
<K
, V
>
Deprecated
switch to ScalarMap if possible, Map otherwise
Defined in
packages/store/src/legacy/legacyMap.js:39
makeLegacyWeakMap
▸ makeLegacyWeakMap<K
, V
>(tag?
): LegacyWeakMap
<K
, V
>
See doccomment in the closely related legacyMap.js
module.
Type parameters
Name |
---|
K |
V |
Parameters
Name | Type | Default value | Description |
---|---|---|---|
tag? | string | 'key' | tag for debugging |
Returns
LegacyWeakMap
<K
, V
>
Deprecated
switch to ScalarWeakMap if possible, WeakMap otherwise
Defined in
packages/store/src/legacy/legacyWeakMap.js:14
makeScalarMapStore
▸ makeScalarMapStore<K
, V
>(tag?
, options?
): MapStore
<K
, V
>
Distinguishes between adding a new key (init) and updating or referencing a key (get, set, delete).
init
is only allowed if the key does not already exist. Get
, set
and delete
are only allowed if the key does already exist.
This is a scalar map in that the keys can only be atomic values, primitives or remotables. Other storeMaps will accept, for example, copyArrays and copyRecords, as keys and look them up based on equality of their contents.
Type parameters
Name | Type |
---|---|
K | extends unknown |
V | extends unknown |
Parameters
Name | Type | Default value | Description |
---|---|---|---|
tag? | string | 'key' | the column name for the key |
options? | StoreOptions | {} | - |
Returns
MapStore
<K
, V
>
Defined in
packages/store/src/stores/scalarMapStore.js:136
makeScalarSetStore
▸ makeScalarSetStore<K
>(tag?
, options?
): SetStore
<K
>
Distinguishes between adding a new key (init) and updating or referencing a key (get, set, delete).
init
is only allowed if the key does not already exist. Get
, set
and delete
are only allowed if the key does already exist.
This is a scalar set in that the keys can only be atomic values, primitives or remotables. Other storeSets will accept, for example, copyArrays and copyRecords, as keys and look them up based on equality of their contents.
Type parameters
Name |
---|
K |
Parameters
Name | Type | Default value | Description |
---|---|---|---|
tag? | string | 'key' | tag for debugging |
options? | StoreOptions | {} | - |
Returns
SetStore
<K
>
Defined in
packages/store/src/stores/scalarSetStore.js:92
makeScalarWeakMapStore
▸ makeScalarWeakMapStore<K
, V
>(tag?
, options?
): WeakMapStore
<K
, V
>
This is a scalar mapStore in that the keys can only be atomic values: primitives or remotables. Other mapStores will accept, for example, copyArrays and copyRecords as keys and look them up based on equality of their contents.
TODO For now, this scalarWeakMap accepts only remotables, reflecting the constraints of the underlying JavaScript WeakMap it uses internally. But it should accept the primitives as well, storing them in a separate internal map. What makes it "weak" is that it provides no API for enumerating what's there. Though note that this would only enables collection of the remotables, since the other primitives may always reappear.
Type parameters
Name |
---|
K |
V |
Parameters
Name | Type | Default value | Description |
---|---|---|---|
tag? | string | 'key' | tag for debugging |
options? | StoreOptions | {} | - |
Returns
WeakMapStore
<K
, V
>
Defined in
packages/store/src/stores/scalarWeakMapStore.js:99
makeScalarWeakSetStore
▸ makeScalarWeakSetStore<K
>(tag?
, options?
): WeakSetStore
<K
>
This is a scalar set in that the keys can only be atomic values, primitives or remotables. Other storeSets will accept, for example, copyArrays and copyRecords, as keys and look them up based on equality of their contents.
TODO For now, this scalarWeakSet accepts only remotables, reflecting the constraints of the underlying JavaScript WeakSet it uses internally. But it should accept the primitives as well, storing them in a separate internal set. What makes it "weak" is that it provides no API for enumerating what's there. Though note that this would only enables collection of the remotables, since the other primitives may always appear.
Type parameters
Name |
---|
K |
Parameters
Name | Type | Default value | Description |
---|---|---|---|
tag? | string | 'key' | tag for debugging |
options? | StoreOptions | {} | - |
Returns
WeakSetStore
<K
>
Defined in
packages/store/src/stores/scalarWeakSetStore.js:81
matches
▸ matches(specimen
, patt
): boolean
Parameters
Name | Type |
---|---|
specimen | any |
patt | any |
Returns
boolean
Defined in
node_modules/@endo/patterns/src/patterns/patternMatchers.d.ts:13
mustMatch
▸ mustMatch(specimen
, patt
, label?
): void
Parameters
Name | Type |
---|---|
specimen | any |
patt | any |
label? | string | number |
Returns
void
Defined in
node_modules/@endo/patterns/src/patterns/patternMatchers.d.ts:14
provideLazy
▸ provideLazy<K
, V
>(mapStore
, key
, makeValue
): V
Call provideLazy
to get or make the value associated with the key. If there already is one, return that. Otherwise, call makeValue(key)
, remember it as the value for that key, and return it.
Type parameters
Name |
---|
K |
V |
Parameters
Name | Type |
---|---|
mapStore | WeakMapStore <K , V > |
key | K |
makeValue | (key : K ) => V |
Returns
V
Defined in
packages/store/src/stores/store-utils.js:97
setCompare
▸ setCompare<K
>(left
, right
): number
Type parameters
Name | Type |
---|---|
K | extends unknown |
Parameters
Name | Type |
---|---|
left | CopySet <K > |
right | CopySet <K > |
Returns
number
Defined in
node_modules/@endo/patterns/src/keys/compareKeys.d.ts:1
setDisjointSubtract
▸ setDisjointSubtract(xset
, yset
): CopySet
Parameters
Name | Type |
---|---|
xset | any |
yset | any |
Returns
CopySet
Defined in
node_modules/@endo/patterns/src/keys/merge-set-operators.d.ts:13
setDisjointUnion
▸ setDisjointUnion(xset
, yset
): CopySet
Parameters
Name | Type |
---|---|
xset | any |
yset | any |
Returns
CopySet
Defined in
node_modules/@endo/patterns/src/keys/merge-set-operators.d.ts:11
setIntersection
▸ setIntersection(xset
, yset
): CopySet
Parameters
Name | Type |
---|---|
xset | any |
yset | any |
Returns
CopySet
Defined in
node_modules/@endo/patterns/src/keys/merge-set-operators.d.ts:12
setIsDisjoint
▸ setIsDisjoint(xset
, yset
): any
Parameters
Name | Type |
---|---|
xset | any |
yset | any |
Returns
any
Defined in
node_modules/@endo/patterns/src/keys/merge-set-operators.d.ts:9
setIsSuperset
▸ setIsSuperset(xset
, yset
): any
Parameters
Name | Type |
---|---|
xset | any |
yset | any |
Returns
any
Defined in
node_modules/@endo/patterns/src/keys/merge-set-operators.d.ts:8
setUnion
▸ setUnion(xset
, yset
): CopySet
Parameters
Name | Type |
---|---|
xset | any |
yset | any |
Returns
CopySet
Defined in
node_modules/@endo/patterns/src/keys/merge-set-operators.d.ts:10