Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • EventEmitter
    • Backup

Index

Constructors

constructor

  • new Backup(options?: EventEmitterOptions): Backup
  • Parameters

    • Optional options: EventEmitterOptions

    Returns Backup

Properties

Private backupDir

backupDir: string

Private checkLndTimer

checkLndTimer: ReturnType<typeof setInterval> | undefined

Private config

config: Config = new Config()

Private databaseChangedMap

databaseChangedMap: Map<string, boolean> = new Map<string, boolean>()

A map of client names to a boolean indicating whether they have changed since the last backup.

Private fileWatchers

fileWatchers: FSWatcher[] = []

Private lndClients

lndClients: LndClient[] = []

Private logger

logger: Logger

Private xudBackupTimer

xudBackupTimer: Timeout = setInterval(() => {if (this.databaseChangedMap.get('xud') === true) {const backupPath = this.getBackupPath('xud');const content = this.readDatabase(this.config.dbpath);this.writeBackup(backupPath, content);this.databaseChangedMap.set('xud', false);}}, 180000)

Static defaultMaxListeners

defaultMaxListeners: number

Static Readonly errorMonitor

errorMonitor: keyof symbol

This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.

Installing a listener using this symbol does not change the behavior once an 'error' event is emitted, therefore the process will still crash if no regular 'error' listener is installed.

Methods

addListener

  • addListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

emit

  • emit(event: "newBackup", path: string): boolean
  • emit(event: "changeDetected", client: string): boolean
  • Parameters

    • event: "newBackup"
    • path: string

    Returns boolean

  • Parameters

    • event: "changeDetected"
    • client: string

    Returns boolean

eventNames

  • eventNames(): Array<string | symbol>
  • Returns Array<string | symbol>

Private getBackupPath

  • getBackupPath(client: string, currency?: undefined | string): string

getMaxListeners

  • getMaxListeners(): number

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

off

  • off(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • on(event: "newBackup", listener: (path: string) => void): this
  • on(event: "changeDetected", listener: (client: string) => void): this
  • Parameters

    • event: "newBackup"
    • listener: (path: string) => void
        • (path: string): void
        • Parameters

          • path: string

          Returns void

    Returns this

  • Parameters

    • event: "changeDetected"
    • listener: (client: string) => void
        • (client: string): void
        • Parameters

          • client: string

          Returns void

    Returns this

once

  • once(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependListener

  • prependListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

Private readDatabase

  • readDatabase(path: string): Buffer

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

start

  • start(args: {}): Promise<void>

Private startFilewatcher

  • startFilewatcher(client: string, dbPath: string): Promise<void>

Private startLndSubscriptions

  • startLndSubscriptions(): Promise<void>

stop

  • stop(): void

Private waitForLndConnected

  • waitForLndConnected(lndClient: LndClient): Promise<unknown>

Private writeBackup

  • writeBackup(backupPath: string, data: Uint8Array): void

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Generated using TypeDoc