s2-tools
Version:
A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.
51 lines • 1.72 kB
TypeScript
import type { Stringifiable } from '..';
import type { Uint64 } from '../../dataStructures/uint64';
/** A key-value entry in the multimap */
export interface MMEntry<V> {
key: Uint64;
value: V[];
}
/** Represents a key-value store */
export interface MultiMapStore<V = Stringifiable> {
length: number;
get: ((key: Uint64) => V[] | undefined) | ((key: Uint64) => Promise<V[] | undefined>);
set: (key: Uint64, value: V) => void;
entries: () => AsyncGenerator<MMEntry<V>>;
[Symbol.asyncIterator]: () => AsyncGenerator<MMEntry<V>>;
close: () => void;
}
/** A constructor for a vector store */
export type MultiMapStoreConstructor<V = Stringifiable> = new () => MultiMapStore<V>;
/** A local multimap key-value store */
export declare class MultiMap<V = Stringifiable> implements MultiMapStore<V> {
#private;
/** Builds a new MultiMap */
constructor();
/** @returns - the length of the map */
get length(): number;
/**
* 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;
/**
* 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;
/**
* iterate through the values
* @yields - The values in the store
*/
entries(): AsyncGenerator<MMEntry<V>>;
/**
* iterate through the values
* @returns - an iterator
*/
[Symbol.asyncIterator](): AsyncGenerator<MMEntry<V>>;
/** Closes the store */
close(): void;
}
//# sourceMappingURL=index.d.ts.map