import type { RustTopicRootDirectoryState } from "@peerbit/stream"; export type TopicRootResolver = (topic: string) => string | undefined | Promise; export type TopicRootTracker = { resolveRoot(topic: string): string | undefined | Promise; }; export type TopicRootDirectoryOptions = { defaultCandidates?: string[]; resolver?: TopicRootResolver; }; export declare class TopicRootDirectory { private readonly explicitRootsByTopic; private defaultCandidates; private resolver?; private native?; constructor(options?: TopicRootDirectoryOptions); /** * Move the root-resolution state (explicit roots + deterministic * candidates) into the native topic-control core. Current contents are * copied over; a directory that already adopted native state keeps it * (the first adoption owns the state, so directories shared between * co-located planes are only migrated once). The resolver callback and * trackers stay host-side. */ adoptNativeState(state: RustTopicRootDirectoryState): void; setRoot(topic: string, root: string): void; deleteRoot(topic: string): void; getRoot(topic: string): string; setDefaultCandidates(candidates: string[]): void; getDefaultCandidates(): string[]; setResolver(resolver?: TopicRootResolver): void; resolveRoot(topic: string): Promise; resolveLocal(topic: string): Promise; resolveDeterministicCandidate(topic: string): string | undefined; } export type TopicRootControlPlaneOptions = TopicRootDirectoryOptions & { directory?: TopicRootDirectory; trackers?: TopicRootTracker[]; }; export declare class TopicRootControlPlane { private readonly directory; private trackers; constructor(options?: TopicRootControlPlaneOptions); /** See {@link TopicRootDirectory.adoptNativeState}. */ adoptNativeDirectoryState(state: RustTopicRootDirectoryState): void; setTopicRoot(topic: string, root: string): void; clearTopicRoot(topic: string): void; getTopicRoot(topic: string): string; setTopicRootCandidates(candidates: string[]): void; getTopicRootCandidates(): string[]; setTopicRootResolver(resolver?: TopicRootResolver): void; setTopicRootTrackers(trackers: TopicRootTracker[]): void; getTopicRootTrackers(): TopicRootTracker[]; resolveLocalTopicRoot(topic: string): Promise; resolveDeterministicTopicRoot(topic: string): string; resolveCanonicalTopicRoot(topic: string): Promise; resolveTrackedTopicRoot(topic: string): Promise; resolveTopicRoot(topic: string): Promise; private resolveWithTrackers; } //# sourceMappingURL=topic-root-control-plane.d.ts.map