Skip to main content

Class: ConnectionManager

ConnectionManager is responsible for managing the connection to IPFS.

Constructors

constructor

new ConnectionManager(events, registry, ipfs, orbit, identityManager, logger)

Creates an instance of ConnectionManager with configs and dependencies injected.

Parameters

NameTypeDescription
eventsSteerEventEmitterAllow for event emitters to be added
registryRegistryRegistry instance which contains the current protocols root db store
ipfsIPFSIPFS instance which is used to interact with the ipfs network
orbitOrbit-
identityManagerIdentityManagerIdentityManager instance which is used to manage the identity
loggerLoggerLogger instance which is used to log events

Defined in

src/classes/connection-manager.ts:46

Properties

connections

connections: Object = {}

Index signature

[key: string]: { connection: any ; statistics: { active: boolean ; loadProgress: number ; peers: string[] ; replicationProgress: number ; status: "inactive" | "active" | "replicating" | "loading" } }

Defined in

src/classes/connection-manager.ts:17


events

events: SteerEventEmitter

Defined in

src/classes/connection-manager.ts:30


identityManager

identityManager: IdentityManager

Defined in

src/classes/connection-manager.ts:34


ipfs

ipfs: IPFS

Defined in

src/classes/connection-manager.ts:32


ipfs_swarm_peer

ipfs_swarm_peer: number = 0

Defined in

src/classes/connection-manager.ts:16


logger

logger: Logger

Defined in

src/classes/connection-manager.ts:35


orbit

orbit: Orbit

Defined in

src/classes/connection-manager.ts:33


registry

registry: Registry

Defined in

src/classes/connection-manager.ts:31


registry_peers

registry_peers: number = 0

Defined in

src/classes/connection-manager.ts:15

Methods

addListeners

addListeners(db): void

Add listeners to the connection to update the statistics and the connection status. These listners events are emitted via the SteerEventEmitter.

Parameters

NameTypeDescription
dbdefaultDB Store instance of the database to add listeners to

Returns

void

Defined in

src/classes/connection-manager.ts:182


open

open<T>(type, nameOrAddress): Promise<T>

Opens a connection with a database utilizing the embedded/linked identity.

Type parameters

Name
T

Parameters

NameTypeDescription
typeDbTypeDBType from Orbit
nameOrAddressstringAddress to a distributed db or a name of one which should be created

Returns

Promise<T>

Store of the requested database

Defined in

src/classes/connection-manager.ts:144


start

start(): Promise<void>

Starts the connecton to the registry which has the chain ids and their respective stategy stores.

Returns

Promise<void>

Defined in

src/classes/connection-manager.ts:65