forked from mmomtchev/SharedMap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
32 lines (24 loc) · 1012 Bytes
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
declare module 'sharedmap' {
class Deadlock extends Error {};
interface SharedMapOptions {
lockWrite: boolean;
lockExclusive: boolean;
}
export class SharedMap {
constructor(maxSize: number, keySize: number, objSize: number);
get length(): number;
get size(): number;
lockExclusive(): void;
unlockExclusive(): void;
lockWrite(): void;
unlockWrite(): void;
set(key: string, value: string | number, options?: SharedMapOptions): void;
get(key: string, options?: SharedMapOptions): string?;
has(key: string, options?: SharedMapOptions): boolean;
delete(key: string, options?: SharedMapOptions): void;
clear(): void;
*keys(options?: SharedMapOptions): Iterable<string>;
map(cb: (currentValue: string, key?: string) => T, thisArg?: unknown): T[];
reduce(cb: (accumulator: T, currentValue: string, key: string) => T, initialValue: T);
}
}