import { Filter, NostrEvent } from "nostr-tools";
import { Subject } from "rxjs";
import { LRU } from "../helpers/lru.js";
import { IEventSet } from "./interface.js";
/**
 * A set of nostr events that can be queried and subscribed to
 * NOTE: does not handle replaceable events or any deletion logic
 */
export declare class EventSet implements IEventSet {
    protected log: import("debug").Debugger;
    /** Indexes */
    protected kinds: Map<number, Set<import("nostr-tools").Event>>;
    protected authors: Map<string, Set<import("nostr-tools").Event>>;
    protected tags: LRU<Set<import("nostr-tools").Event>>;
    protected created_at: NostrEvent[];
    /** LRU cache of last events touched */
    events: LRU<import("nostr-tools").Event>;
    /** A sorted array of replaceable events by address */
    protected replaceable: Map<string, import("nostr-tools").Event[]>;
    /** A stream of events inserted into the database */
    insert$: Subject<import("nostr-tools").Event>;
    /** A stream of events that have been updated */
    update$: Subject<import("nostr-tools").Event>;
    /** A stream of events removed from the database */
    remove$: Subject<import("nostr-tools").Event>;
    /** A method thats called before a new event is inserted */
    onBeforeInsert?: (event: NostrEvent) => boolean;
    /** The number of events in the event set */
    get size(): number;
    /** Moves an event to the top of the LRU cache */
    touch(event: NostrEvent): void;
    /** Checks if the database contains an event without touching it */
    hasEvent(id: string): boolean;
    /** Gets a single event based on id */
    getEvent(id: string): NostrEvent | undefined;
    /** Checks if the event set has a replaceable event */
    hasReplaceable(kind: number, pubkey: string, identifier?: string): boolean;
    /** Gets the latest replaceable event */
    getReplaceable(kind: number, pubkey: string, identifier?: string): NostrEvent | undefined;
    /** Gets the history of a replaceable event */
    getReplaceableHistory(kind: number, pubkey: string, identifier?: string): NostrEvent[] | undefined;
    /** Gets all events that match the filters */
    getByFilters(filters: Filter | Filter[]): Set<NostrEvent>;
    /** Gets a timeline of events that match the filters */
    getTimeline(filters: Filter | Filter[]): NostrEvent[];
    /** Inserts an event into the database and notifies all subscriptions */
    add(event: NostrEvent): NostrEvent | null;
    /** Inserts and event into the database and notifies all subscriptions that the event has updated */
    update(event: NostrEvent): boolean;
    /** Removes an event from the database and notifies all subscriptions */
    remove(eventOrId: string | NostrEvent): boolean;
    /** A weak map of events that are claimed by other things */
    protected claims: WeakMap<import("nostr-tools").Event, any>;
    /** Sets the claim on the event and touches it */
    claim(event: NostrEvent, claim: any): void;
    /** Checks if an event is claimed by anything */
    isClaimed(event: NostrEvent): boolean;
    /** Removes a claim from an event */
    removeClaim(event: NostrEvent, claim: any): void;
    /** Removes all claims on an event */
    clearClaim(event: NostrEvent): void;
    /** Index helper methods */
    protected getKindIndex(kind: number): Set<import("nostr-tools").Event>;
    protected getAuthorsIndex(author: string): Set<import("nostr-tools").Event>;
    protected getTagIndex(tagAndValue: string): Set<import("nostr-tools").Event>;
    /** Iterates over all events by author */
    iterateAuthors(authors: Iterable<string>): Generator<NostrEvent>;
    /** Iterates over all events by indexable tag and value */
    iterateTag(tag: string, values: Iterable<string>): Generator<NostrEvent>;
    /** Iterates over all events by kind */
    iterateKinds(kinds: Iterable<number>): Generator<NostrEvent>;
    /** Iterates over all events by time */
    iterateTime(since: number | undefined, until: number | undefined): Generator<NostrEvent>;
    /** Iterates over all events by id */
    iterateIds(ids: Iterable<string>): Generator<NostrEvent>;
    /** Returns all events that match the filter */
    getEventsForFilter(filter: Filter): Set<NostrEvent>;
    /** Returns all events that match the filters */
    getEventsForFilters(filters: Filter[]): Set<NostrEvent>;
    /** Remove the oldest events that are not claimed */
    prune(limit?: number): number;
    /** Resets the event set */
    reset(): void;
}
