char/avril

(wip) why'd you have to go and make things so complicaaaaated?

git clone https://git.t4t.associates/char/avril

Charlotte Somadd `avril:kv` module78f4748

main
1.3 KiB32 linesraw
1declare module "ext:core/ops" {
2  export function op_kv_open(args: [path: string, access: string, create: boolean]): Promise<number>;
3  export function op_kv_close(id: number): Promise<void>;
4  export function op_kv_list_keyspaces(id: number): Promise<string[]>;
5  export function op_kv_get_many(
6    args: [db: number, keyspace: string, keys: Uint8Array[]],
7  ): Promise<([value: Uint8Array, stamp: string] | null)[]>;
8  export function op_kv_set(
9    args: [db: number, keyspace: string, key: Uint8Array, value: Uint8Array],
10  ): Promise<string>;
11  export function op_kv_delete(args: [db: number, keyspace: string, key: Uint8Array]): Promise<void>;
12  export function op_kv_list(args: {
13    db: number;
14    keyspace: string;
15    start: Uint8Array | null;
16    end: Uint8Array | null;
17    prefix: Uint8Array | null;
18    limit: number;
19    reverse: boolean;
20  }): Promise<[key: Uint8Array, value: Uint8Array, stamp: string][]>;
21  export function op_kv_clear(args: [db: number, keyspace: string]): Promise<void>;
22  export function op_kv_atomic(
23    args: [
24      db: number,
25      ops: (
26        | { t: "check"; ks: string; key: Uint8Array; expected: string | null }
27        | { t: "set"; ks: string; key: Uint8Array; value: Uint8Array }
28        | { t: "delete"; ks: string; key: Uint8Array }
29      )[],
30    ],
31  ): Promise<[ok: boolean, stamp: string | null]>;
32}