import type { AnnouncePubSub } from "@pokapali/core/announce"; import type { HistoryTracker, RetentionConfig } from "./history.js"; import type { Helia } from "helia"; export interface PinnerConfig { appIds: string[]; rateLimits?: { maxPerHour?: number; maxSizeBytes?: number; }; storagePath: string; maxConnections?: number; helia?: Helia; /** PubSub for publishing ack messages. */ pubsub?: AnnouncePubSub; /** Stable peer ID for ack attribution. */ peerId?: string; /** Version retention tiers for thinning. */ retentionConfig?: RetentionConfig; /** Max IPNS requests per second to delegated * routing. Default: 10. */ ipnsRateLimit?: number; /** Drop names with no GossipSub activity and no * successful IPNS resolve after this many days. * Default: 3. Set to 0 to disable. */ staleResolveDays?: number; /** Hard cap on tracked IPNS names. New * announcements for unknown names are dropped when * at capacity. Default: 10 000. */ maxNames?: number; /** Max new IPNS names admitted per hour. Global * rate limit to prevent name-flooding abuse. * Default: 100. Set to 0 to reject all new names. */ maxNewNamesPerHour?: number; } export interface PinnerMetrics { knownNames: number; tipsTracked: number; acksTracked: number; snapshotsIngested: number; rateLimitRejects: number; capacityRejects: number; newNameRejects: number; reannounceCount: number; lastReannounceMs: number; lastPersistMs: number; stateWriteCount: number; ipnsThrottleAcquired: number; ipnsThrottleRejected: number; stalePruned: number; staleDeactivated: number; deactivatedNames: number; } export interface TipData { ipnsName: string; cid: string; block: Uint8Array; seq: number; ts: number; peerId: string; guaranteeUntil: number; retainUntil: number; } export interface GuaranteeData { ipnsName: string; cid: string; peerId: string; guaranteeUntil: number; retainUntil: number; } export interface Pinner { start(): Promise; stop(): Promise; /** Await all pending background work. */ flush(): Promise; ingest(ipnsName: string, block: Uint8Array): Promise; onAnnouncement(ipnsName: string, cidStr: string, appId?: string, blockData?: Uint8Array, fromPinner?: boolean, proof?: string): void; onGuaranteeQuery(ipnsName: string, appId: string): void; /** Get tip block + guarantee for HTTP endpoint. */ getTipData(ipnsName: string): Promise; /** Get guarantee status for HTTP endpoint. */ getGuarantee(ipnsName: string): GuaranteeData | null; /** Record browser activity (HTTP access). */ recordActivity(ipnsName: string): void; metrics(): PinnerMetrics; history: HistoryTracker; } export declare function createPinner(config: PinnerConfig): Promise; //# sourceMappingURL=pinner.d.ts.map