import { Sink, Source, Spec } from './telem';
import { Factory } from './factory';
import { aether } from '../../aether/aether';
import { observe } from '@synnaxlabs/x/observe';
import { Destructor } from '@synnaxlabs/x/destructor';

export interface Provider {
    clusterKey: string;
    key: string;
    equals: (other: Provider) => boolean;
    registerFactory: (f: Factory) => void;
    create: <T>(props: Spec) => T;
}
export declare const useProvider: (ctx: aether.Context) => Provider;
export declare const setProvider: (ctx: aether.Context, prov: Provider) => void;
export declare const registerFactory: (ctx: aether.Context, f: Factory) => void;
declare class MemoizedSource<V> implements Source<V> {
    private readonly spec;
    private readonly wrapped;
    private readonly prevKey;
    constructor(wrapped: Source<V>, prevProv: Provider, prevSpec: Spec);
    value(): Promise<V>;
    cleanup(): Promise<void>;
    onChange(handler: observe.Handler<void>): Destructor;
    shouldUpdate(prov: Provider, spec: Spec): boolean;
}
declare class MemoizedSink<V> implements Sink<V> {
    private readonly spec;
    private readonly prov;
    private readonly prevKey;
    private readonly wrapped;
    constructor(wrapped: Sink<V>, prevProv: Provider, prevSpec: Spec);
    set(value: V): Promise<void>;
    cleanup(): Promise<void>;
    shouldUpdate(prov: Provider, spec: Spec): boolean;
}
export declare const useSource: <V>(ctx: aether.Context, spec: Spec, prev: Source<V>) => Promise<MemoizedSource<V>>;
export declare const useSink: <V>(ctx: aether.Context, spec: Spec, prev: Sink<V>) => Promise<MemoizedSink<V>>;
export {};
//# sourceMappingURL=context.d.ts.map