KeySet Class

A class that holds multiple Key objects. It's basically used as a container that holds multiple keys of different types.

Methods

Name Description
constructor(source?: Keys): KeySet Creates an instance of KeySet.  
add(value: Key | Keys, pred?: (key: Key) => boolean): KeySet Add a key or keys to this KeySet.  
clear(): KeySet Clear this KeySet.  
delete(value: Key | Keys): KeySet Deletes a key or keys from this KeySet.  
forEach(callback: (key: InstanceKey | NodeKey, index: number) => void): void Iterate over all keys in this keyset.  
forEachBatch(batchSize: number, callback: (batch: KeySet, index: number) => void): void Iterate over all keys in this keyset in batches  
has(value: Key): boolean Check if this KeySet contains the specified key.  
hasAll(keys: Keys): boolean Check if this KeySet contains all the specified keys.  
hasAny(keys: Keys): boolean Check if this KeySet contains any of the specified keys.  
some(callback: (key: Key) => boolean): boolean Iterate over all keys in this keyset.  
toJSON(): KeySetJSON Serializes this KeySet to JSON  
fromJSON(json: KeySetJSON): KeySet Static Creates a KeySet from JSON  

Properties

Name Type Description
guid Accessor ReadOnly string Get a GUID that identifies changes in this keyset.  
instanceKeys Accessor ReadOnly Map<string, Set<string>> Get a map of instance keys stored in this KeySet  
instanceKeysCount Accessor ReadOnly number Get instance keys count  
isEmpty Accessor ReadOnly boolean Is this KeySet currently empty.  
nodeKeys Accessor ReadOnly Set<NodeKey> Get a set of node keys stored in this KeySet  
nodeKeysCount Accessor ReadOnly number Get node keys count  
size Accessor ReadOnly number Get the number of keys stored in this KeySet.  

Defined in

Last Updated: 20 June, 2023