Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IStorageDriver

Pluggable Storage Drivers You can create plugins for TeDB to provide different mediums of storage. Below you'll find methods that TeDB will expect in your plugin. Storage plugins implement a simple key-value store.

Hierarchy

  • IStorageDriver

Index

Methods

clear

  • clear(): Promise<null>

fetchIndex

  • fetchIndex(key: string): Promise<any[]>
  • Retrieve the JSON from the file to be loaded into the datastore indices

    Parameters

    • key: string

      the path to the element in the object

    Returns Promise<any[]>

getItem

  • getItem(key: string): Promise<any>

iterate

  • iterate(iteratorCallback: function): Promise<any>
  • Iterate every key-value pair, IterationCallback should return truthy to break iteration(resulting in promise resolution) IterationCallback should throw exceptions if error occurs, this will be caught by the promise and propagate up the promise chain and handled accordingly. TODO: Add Error types for StorageDrivers

    Parameters

    • iteratorCallback: function

      Function to iterate key values pairs, return truthy to break iteration

        • (key: string, value: any, iteratorNumber?: undefined | number): any
        • Parameters

          • key: string
          • value: any
          • Optional iteratorNumber: undefined | number

          Returns any

    Returns Promise<any>

keys

  • keys(): Promise<string[]>

removeIndex

  • removeIndex(key: string): Promise<null>
  • Remove the saved JSON of a specific Index

    Parameters

    • key: string

    Returns Promise<null>

removeItem

  • removeItem(key: string): Promise<null>

setItem

  • setItem(key: string, value: any): Promise<any>
  • Insert or Modify key-value pair

    Parameters

    • key: string
    • value: any

    Returns Promise<any>

storeIndex

  • storeIndex(key: string, index: string): Promise<any>
  • Store the index into its own file

    Parameters

    • key: string

      the path to the element in the object

    • index: string

      the JSON index

    Returns Promise<any>

Generated using TypeDoc