import type { HexString } from '@polkadot/util/types'; import type { Api } from '../api.js'; import type { Database } from '../database.js'; export declare enum StorageValueKind { Deleted = "Deleted", DeletedPrefix = "DeletedPrefix" } export type StorageValue = string | StorageValueKind | undefined; export interface StorageLayerProvider { /** * Returns true if key is deleted */ deleted(key: string): boolean; /** * Get the value of a storage key. */ get(key: string, cache: boolean): Promise; /** * Get the value of many storage keys. */ getMany(keys: string[], _cache: boolean): Promise; /** * Get paged storage keys. */ getKeysPaged(prefix: string, pageSize: number, startKey: string): Promise; /** * Find next storage key. */ findNextKey(prefix: string, startKey: string, knownBest?: string): Promise; } export declare class RemoteStorageLayer implements StorageLayerProvider { #private; constructor(api: Api, at: HexString, db: Database | undefined); deleted(_key: string): boolean; get(key: string, _cache: boolean): Promise; getMany(keys: string[], _cache: boolean): Promise; findNextKey(prefix: string, startKey: string, _knownBest?: string): Promise; getKeysPaged(prefix: string, pageSize: number, startKey: string): Promise; } export declare class StorageLayer implements StorageLayerProvider { #private; constructor(parent?: StorageLayerProvider); deleted(key: string): boolean; get(key: string, cache: boolean): Promise; getMany(keys: string[], cache: boolean): Promise; set(key: string, value: StorageValue): void; setAll(values: Record | [string, StorageValue | null][]): void; findNextKey(prefix: string, startKey: string, knownBest?: string): Promise; getKeysPaged(prefix: string, pageSize: number, startKey: string): Promise; /** * Merge the storage layer into the given object, can be used to get sotrage diff. */ mergeInto(into: Record): Promise; }