import * as pb from "../proto/handlerpb/handler_pb"; import type { MapCodec } from "./map-codec"; /** * MapState manages a persisted map of key-value pairs. * * MapStates are created using the {@link topology.MapSpec.stateFor} method. * * @typeParam K The key type * @typeParam V The value type */ export declare class MapState { #private; /** * @ignore */ constructor(name: string, codec: MapCodec, stateEntries: pb.StateEntry[]); /** * Retrieves a value by its key. * * @param key The key to look up * @returns The value associated with the key, or undefined if not found */ get(key: K): V | undefined; /** * Sets a value for the given key. * * @param key The key to associate with the value * @param value The value to store */ set(key: K, value: V): void; /** * Deletes a key-value pair and marks the key as modified. * * @param key The key to delete */ delete(key: K): void; /** * Checks if a key exists in the state. * * @param key The key to check * @returns true if the key exists, false otherwise */ has(key: K): boolean; /** * Returns an iterator for all key-value pairs in the state. * * @returns An iterator yielding [key, value] pairs */ entries(): IterableIterator<[K, V]>; /** * Returns an iterator for all keys in the state. * * @returns An iterator yielding keys */ keys(): IterableIterator; /** * Returns an iterator for all values in the state. * * @returns An iterator yielding values */ values(): MapIterator; /** * Clears all entries from the state and marks all existing keys as dirty. */ clear(): void; /** * Gets the number of entries in the state. * * @returns The number of entries */ get size(): number; /** * Gets the name of this state map. * * @returns The state map name */ get name(): string; }