blob: dc39fdacb453d381ba9aafa1c351eca4bb73c069 (
plain)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
export interface DatabaseInterface {
/**
* Init the database with state
* stored in the cache file.
*
* Calling init is not mandatory,
* but is required for any form
* of non-volatile storage
*/
init(): Promise<void>;
/**
* Read data from the "node" described by path
* where path uses "/" to separate nodes
*
* null is returned if there is no data
* at path
*/
read(path: string): Promise<Object>;
/**
* Write data to the node described by path
* where path once again uses "/" separate nodes
*
* toWrite can be any plain JavaScript object
* (e.g anything that can be serialized with JSON.stringify)
*
* An exception is thrown if the write fails
*/
write(path: string, toWrite: Object): Promise<void>;
/**
* Remove data at path
*/
remove(path: string): Promise<void>;
/**
* Empty the database
*/
flush(): Promise<void>;
/**
* String representation (JSON) of the database
*/
toString(): Object;
}
|