Class VaultManager

Hierarchy

  • CreateDestroyStartStop
    • VaultManager

Constructors

Properties

[initLock]: RWLockWriter
acl: ACL
db: DB
efs: EncryptedFS
efsDb: DB
efsPath: string
gestaltGraph: GestaltGraph
keyRing: KeyRing
logger: Logger
nodeConnectionManager: NodeConnectionManager
notificationsManager: NotificationsManager
vaultIdGenerator: (() => VaultId) = ...

Type declaration

vaultKey: Buffer
vaultLocks: LockBox<RWLockWriter> = ...
vaultMap: VaultMap = ...
vaultsDbPath: readonly (string | Buffer)[] = ...
vaultsNamesDbPath: readonly (string | Buffer)[] = ...
vaultsPath: string

Accessors

  • get [destroyed](): boolean
  • Returns boolean

  • get [eventHandled](): ReadonlyWeakSet<Event>
  • Returns ReadonlyWeakSet<Event>

  • get [eventHandlers](): ReadonlyMap<string, Set<EventHandlerInfo>>
  • Returns ReadonlyMap<string, Set<EventHandlerInfo>>

  • get [eventTarget](): EventTarget
  • Returns EventTarget

  • get [handleEventError](): ((evt) => void)
  • Returns ((evt) => void)

      • (evt): void
      • Parameters

        • evt: EventError

        Returns void

  • get [running](): boolean
  • Returns boolean

  • get [statusP](): Promise<Status>
  • Returns Promise<Status>

  • get [status](): Status
  • Returns Status

Methods

  • Parameters

    • type: string
    • callback: null | EventListenerOrEventListenerObject
    • Optional options: boolean | AddEventListenerOptions

    Returns void

  • Removes vault from the vault map

    Parameters

    • vaultId: VaultId
    • Optional tran: DBTransaction

    Returns Promise<void>

  • Constructs a new vault instance with a given name and stores it in memory

    Parameters

    • vaultName: string
    • Optional tran: DBTransaction

    Returns Promise<VaultId>

  • Removes the metadata and EFS state of a vault using a given VaultId

    Parameters

    • vaultId: VaultId
    • Optional tran: DBTransaction

    Returns Promise<void>

  • Parameters

    • event: Event

    Returns boolean

  • Retrieves the VaultId associated with a vault name

    Parameters

    • vaultName: string
    • Optional tran: DBTransaction

    Returns Promise<undefined | VaultId>

  • Retrieves the vault metadata using the VaultId and parses it to return the associated vault name

    Parameters

    • vaultId: VaultId
    • Optional tran: DBTransaction

    Returns Promise<undefined | VaultMetadata>

  • Retrieves the vault name associated with a VaultId

    Parameters

    • vaultId: VaultId
    • Optional tran: DBTransaction

    Returns Promise<undefined | string>

  • Returns a dictionary of VaultActions for each node

    Parameters

    • vaultId: VaultId
    • Optional tran: DBTransaction

    Returns Promise<Record<NodeId, Partial<Record<"clone" | "pull", null>>>>

  • Handler for receiving http GET requests when being cloned or pulled from

    Parameters

    • vaultId: VaultId
    • Optional tran: DBTransaction

    Returns AsyncGenerator<Buffer, any, unknown>

  • Handler for receiving http POST requests when being cloned or pulled from

    Parameters

    • vaultId: VaultId
    • body: Buffer
    • Optional tran: DBTransaction

    Returns Promise<[PassThrough, PassThrough]>

  • Returns all the shared vaults for a NodeId.

    Parameters

    • nodeId: NodeId
    • Optional tran: DBTransaction

    Returns AsyncGenerator<{
        vaultId: VaultId;
        vaultName: string;
        vaultPermissions: ("clone" | "pull")[];
    }, any, unknown>

  • Lists the vault name and associated VaultId of all the vaults stored

    Parameters

    • Optional tran: DBTransaction

    Returns Promise<VaultList>

  • Pulls the contents of a remote vault into an existing vault instance

    Parameters

    • __namedParameters: {
          pullNodeId?: NodeId;
          pullVaultNameOrId?: string | VaultId;
          tran?: DBTransaction;
          vaultId: VaultId;
      }
      • Optional pullNodeId?: NodeId
      • Optional pullVaultNameOrId?: string | VaultId
      • Optional tran?: DBTransaction
      • vaultId: VaultId

    Returns Promise<void>

  • Parameters

    • type: string
    • callback: null | EventListenerOrEventListenerObject
    • Optional options: boolean | EventListenerOptions

    Returns void

  • Changes the vault name metadata of a VaultId

    Parameters

    • vaultId: VaultId
    • newVaultName: string
    • Optional tran: DBTransaction

    Returns Promise<void>

  • Retrieves all the vaults for a peers node

    Parameters

    Returns AsyncGenerator<{
        vaultIdEncoded: VaultIdEncoded;
        vaultName: string;
        vaultPermissions: ("clone" | "pull")[];
    }, any, unknown>

  • Sets clone, pull and scan permissions of a vault for a gestalt and send a notification to this gestalt

    Parameters

    Returns Promise<void>

  • Parameters

    • __namedParameters: {
          fresh?: boolean;
      } = {}
      • Optional fresh?: boolean

    Returns Promise<void>

  • Unsets clone, pull and scan permissions of a vault for a gestalt

    Parameters

    Returns Promise<void>

  • Takes a function and runs it with the listed vaults. locking is handled automatically

    Type Parameters

    • T

    Parameters

    • vaultIds: VaultId[]

      List of vault ID for vaults you wish to use

    • f: ((...args) => Promise<T>)

      Function you wish to run with the provided vaults

        • (...args): Promise<T>
        • Parameters

          Returns Promise<T>

    • Optional tran: DBTransaction

    Returns Promise<T>

Generated using TypeDoc