Skip to content

Commit

Permalink
* make callbacks on set and setAll for BaseRemoteMap to be manda…
Browse files Browse the repository at this point in the history
…tory
  • Loading branch information
balazskreith committed Sep 4, 2024
1 parent 1ca2500 commit 5d46ec2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/collections/HamokRemoteMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export class HamokRemoteMap<K, V> extends EventEmitter {
insertedEntries.set(key, value);
}

await this.remoteMap.setAll(request.entries);
await this.remoteMap.setAll(request.entries, () => void 0);

return insertedEntries;
}, commitIndex, (insertedEntries) => {
Expand Down Expand Up @@ -209,7 +209,7 @@ export class HamokRemoteMap<K, V> extends EventEmitter {
// logger.warn('Conditional update request: %s, %s, %s, %s', key, value, existingValue, request.prevValue);

if (existingValue && this.equalValues(existingValue, request.prevValue)) {
await this.remoteMap.set(key, value);
await this.remoteMap.set(key, value, () => void 0);
updatedEntries.push([ key, existingValue, value ]);
// logger.warn('Conditional update request: %s, %s, %s, %s', key, value, existingValue, request.prevValue);
}
Expand Down
4 changes: 2 additions & 2 deletions src/collections/RemoteMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export interface RemoteMap<K, V> {
keys(): Promise<IterableIterator<K>>;
get(key: K): Promise<V | undefined>;
getAll(keys: IterableIterator<K>): Promise<ReadonlyMap<K, V>>;
set(key: K, value: V, callback?: (oldValue: V | undefined) => void): Promise<void>;
setAll(entries: ReadonlyMap<K, V>, callback?: (result: RemoteMapUpdateResult<K, V>) => void): Promise<void>;
set(key: K, value: V, callback: (oldValue: V | undefined) => void): Promise<void>;
setAll(entries: ReadonlyMap<K, V>, callback: (result: RemoteMapUpdateResult<K, V>) => void): Promise<void>;
remove(key: K): Promise<V | undefined>;
removeAll(keys: IterableIterator<K>): Promise<ReadonlyMap<K, V>>;
iterator(): AsyncIterableIterator<[K, V]>;
Expand Down

0 comments on commit 5d46ec2

Please sign in to comment.