@metamask/kernel-store
Version:
Ocap Kernel storage abstractions and implementations
1 lines • 1.2 kB
Source Map (JSON)
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["export type KVStore = {\n get(key: string): string | undefined;\n getRequired(key: string): string;\n getNextKey(previousKey: string): string | undefined;\n set(key: string, value: string): void;\n delete(key: string): void;\n};\n\nexport type KVPair = [string, string];\n\n/**\n * A vat checkpoint is a tuple of two arrays describing the changes since the previous checkpoint:\n * - The first array contains updated key-value pairs.\n * - The second array contains deleted keys.\n */\nexport type VatCheckpoint = [KVPair[], string[]];\n\nexport type VatKVStore = KVStore & {\n checkpoint(): VatCheckpoint;\n};\n\nexport type VatStore = {\n getKVData(): KVPair[];\n updateKVData(sets: KVPair[], deletes: string[]): void;\n};\n\nexport type KernelDatabase = {\n kernelKVStore: KVStore;\n executeQuery(sql: string): Record<string, string>[];\n clear(): void;\n makeVatStore(vatID: string): VatStore;\n deleteVatStore(vatID: string): void;\n createSavepoint(name: string): void;\n rollbackSavepoint(name: string): void;\n releaseSavepoint(name: string): void;\n};\n"]}