import { Destructor } from '@synnaxlabs/x/destructor';
import { observe } from '@synnaxlabs/x/observe';
import { aether } from '../../aether/aether';
import { CompoundTelemFactory, CreateOptions, Factory } from './factory';
import { Sink, Source, Spec } from './telem';
/**
 * Provides utilities for creating and managing telemetry sources and sinks.
 */
export declare class Context {
    private factory;
    readonly key: string;
    readonly parent?: Context;
    constructor(factory: CompoundTelemFactory, parent?: Context);
    child(factories: Factory | Factory[], parent?: Context): Context;
    create<T>(spec: Spec, options?: CreateOptions): T;
}
export declare const CONTEXT_KEY = "pluto-telem-context";
export declare const useContext: (ctx: aether.Context) => Context;
export declare const setContext: (ctx: aether.Context, prov: Context) => void;
export declare const useChildContext: (ctx: aether.Context, factories: Factory | Factory[], prev: Context) => Context;
declare class Memoized<V> {
    private readonly spec;
    readonly wrapped: V;
    private readonly prevProv;
    constructor(wrapped: V, prevProv: Context, prevSpec: Spec);
    shouldUpdate(prov: Context, spec: Spec): boolean;
}
declare class MemoizedSource<V> extends Memoized<Source<V>> {
    value(): V;
    cleanup(): void;
    onChange(handler: observe.Handler<void>): Destructor;
}
declare class MemoizedSink<V> extends Memoized<Sink<V>> {
    set(...values: V[]): void;
    cleanup(): void;
}
export declare const useSource: <V>(ctx: aether.Context, spec: Spec, prev: Source<V>, options?: CreateOptions) => MemoizedSource<V>;
export declare const useSink: <V>(ctx: aether.Context, spec: Spec, prev: Sink<V>, options?: CreateOptions) => MemoizedSink<V>;
export {};
//# sourceMappingURL=context.d.ts.map