UNPKG

ipfs-core

Version:

JavaScript implementation of the IPFS specification

52 lines 2.17 kB
/** * @typedef {import('@libp2p/interfaces').AbortOptions} AbortOptions */ export class IpnsPubsubDatastore { /** * @param {import('@libp2p/interface-pubsub').PubSub} pubsub * @param {import('interface-datastore').Datastore} localDatastore * @param {import('@libp2p/interface-peer-id').PeerId} peerId */ constructor(pubsub: import('@libp2p/interface-pubsub').PubSub, localDatastore: import('interface-datastore').Datastore, peerId: import('@libp2p/interface-peer-id').PeerId); /** @type {Record<string, string>} */ _subscriptions: Record<string, string>; /** * Modify subscription key to have a proper encoding * * @param {Uint8Array | string} key */ _handleSubscriptionKey(key: Uint8Array | string): Uint8Array; _pubsubDs: PubSubDatastore; /** * Put a value to the pubsub datastore indexed by the received key properly encoded. * * @param {Uint8Array} key - identifier of the value. * @param {Uint8Array} value - value to be stored. * @param {AbortOptions} [options] */ put(key: Uint8Array, value: Uint8Array, options?: import("@libp2p/interfaces").AbortOptions | undefined): Promise<void>; /** * Get a value from the pubsub datastore indexed by the received key properly encoded. * Also, the identifier topic is subscribed to and the pubsub datastore records will be * updated once new publishes occur. * * @param {Uint8Array} key - identifier of the value to be obtained. * @param {AbortOptions} [options] */ get(key: Uint8Array, options?: import("@libp2p/interfaces").AbortOptions | undefined): Promise<Uint8Array | undefined>; /** * Get pubsub subscriptions related to ipns. */ getSubscriptions(): string[]; /** * Cancel pubsub subscriptions related to ipns. * * @param {string} name - ipns path to cancel the pubsub subscription. */ cancel(name: string): Promise<{ canceled: boolean; }>; } export type AbortOptions = import('@libp2p/interfaces').AbortOptions; import { PubSubDatastore } from "datastore-pubsub"; //# sourceMappingURL=pubsub-datastore.d.ts.map