UNPKG

s2-tools

Version:

A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.

46 lines 1.54 kB
import type { Stringifiable } from '..'; import type { Uint64 } from '../../dataStructures/uint64'; /** Represents a key-value store */ export interface KVStore<V = Stringifiable> { length: number; get: ((key: Uint64) => V | undefined) | ((key: Uint64) => Promise<V | undefined>); set: (key: Uint64, value: V) => void; values: () => AsyncGenerator<V>; [Symbol.asyncIterator]: () => AsyncGenerator<V>; close: () => void; } /** A constructor for a vector store */ export type KVStoreConstructor<V = Stringifiable> = new (fileName?: string) => KVStore<V>; /** Just a placeholder to explain what a local key-value store essentially is */ export declare class KV<V = Stringifiable> implements KVStore<V> { #private; /** @returns - the length of the map */ get length(): number; /** * Gets the list of values associated with a key * @param key - the key * @returns the list of values if the map contains values for the key */ get(key: Uint64): V | undefined; /** * Adds a value to the list of values associated with a key * @param key - the key * @param value - the value to store */ set(key: Uint64, value: V): void; /** * iterate through the values * @yields an iterator */ values(): AsyncGenerator<V>; /** * iterate through the values * @returns an iterator */ [Symbol.asyncIterator](): AsyncGenerator<V>; /** * Closes the store */ close(): void; } //# sourceMappingURL=index.d.ts.map