tachyon-drive
    Preparing search index...

    Interface IStorageDriver<Input, JsonOutput>

    Interface for a storage driver that provides a simple interface for storing and retrieving data using a specified storage mechanism.

    The type of the data to serialize and deserialize.

    v0.11.0

    interface IStorageDriver<
        Input,
        JsonOutput extends StorageDriverJson = StorageDriverJson,
    > {
        bandwidth: TachyonBandwidth;
        isInitialized: boolean;
        name: string;
        clear(): void | Promise<void>;
        clearResult(): IResult<void> | Promise<IResult<void>>;
        clone(data: Input): Input;
        cloneResult(data: Input): IResult<Input>;
        hydrate(
            options?: IHydrateOptions,
        ): undefined | Input | Promise<undefined | Input>;
        hydrateResult(
            options?: IHydrateOptions,
        ): IResult<undefined | Input> | Promise<IResult<undefined | Input>>;
        init(): boolean | Promise<boolean>;
        initResult(): IResult<boolean> | Promise<IResult<boolean>>;
        store(data: Input): void | Promise<void>;
        storeResult(data: Input): IResult<void> | Promise<IResult<void>>;
        toJSON(): AsJson<JsonOutput>;
        toString(): string;
        unload(): boolean | Promise<boolean>;
        unloadResult(): IResult<boolean> | Promise<IResult<boolean>>;
    }

    Type Parameters

    • Input

      The type of the data to store and retrieve.

    • JsonOutput extends StorageDriverJson = StorageDriverJson

      The type of the data from the JSON representation of the storage driver.

    Hierarchy

    Implemented by

    Index

    Properties

    bandwidth: TachyonBandwidth

    Indicates the speed of the storage driver.

    isInitialized: boolean

    Indicates whether or not the storage driver has been initialized.

    name: string

    The name of the storage driver.

    Methods

    • Clears the stored data.

      Returns void | Promise<void>

    • Clears the stored data and returns the Promise of Result.

      Returns IResult<void> | Promise<IResult<void>>

      Promise of the result object, see Result

    • Clone the data

      Parameters

      Returns Input

    • Clone the data and return the Result

      Parameters

      Returns IResult<Input>

    • Retrieves the stored data.

      Parameters

      • Optionaloptions: IHydrateOptions

        The options to use for hydrating the data.

      Returns undefined | Input | Promise<undefined | Input>

      Promise that resolves to the stored data, or undefined if no data was stored.

    • Retrieves the stored data and returns the Promise of Result.

      Parameters

      • Optionaloptions: IHydrateOptions

        The options to use for hydrating the data.

      Returns IResult<undefined | Input> | Promise<IResult<undefined | Input>>

      Promise of the result object, see Result

    • Initializes the storage driver.

      Returns boolean | Promise<boolean>

      A boolean or promise of boolean that resolves to true if the storage driver was successfully initialized, or false otherwise.

    • Initializes the storage driver and returns the Promise of Result.

      Returns IResult<boolean> | Promise<IResult<boolean>>

      Promise of the result object, see Result

    • Stores the given data using the specified key.

      Parameters

      • data: Input

        Promise that resolves to the data to store.

      Returns void | Promise<void>

      Promise that resolves when the data has been stored.

    • Stores the given data using the specified key and returns the Promise of Result.

      Parameters

      • data: Input

        Promise that resolves to the data to store.

      Returns IResult<void> | Promise<IResult<void>>

      Promise of the result object, see Result

    • Returns a JSON representation of the storage driver

      Returns AsJson<JsonOutput>

    • Returns a string representation of the storage driver.

      Returns string

    • Unload the storage driver.

      Returns boolean | Promise<boolean>

      A promise that resolves to true if the storage driver was successfully unloaded, or false otherwise.

    • Unload the storage driver and returns the Promise of Result.

      Returns IResult<boolean> | Promise<IResult<boolean>>

      Promise of the result object, see Result