Vana SDK - v2.2.2
    Preparing search index...

    Interface IOperationStore

    Interface for operation storage backends.

    Implementations of this interface provide persistent storage for queued operations in a distributed relayer system. This allows operations to be processed asynchronously and recovered after failures.

    Common implementations include:

    • PostgreSQL for production environments
    • MongoDB for document-based storage
    • DynamoDB for serverless deployments
    • In-memory storage for testing
    class PostgresOperationStore implements IOperationStore {
    async storeOperation(operation) {
    await this.db.query(
    'INSERT INTO operations (id, status, data) VALUES ($1, $2, $3)',
    [operation.id, 'queued', operation.data]
    );
    }

    async getQueuedOperations(options) {
    const result = await this.db.query(
    'SELECT * FROM operations WHERE status = $1 LIMIT $2',
    ['queued', options.limit || 100]
    );
    return result.rows;
    }
    }
    interface IOperationStore {
        storeOperation(
            operation: { id: string; data: any; metadata?: any },
        ): Promise<void>;
        getQueuedOperations(
            options?: { limit?: number },
        ): Promise<StoredOperation[]>;
        updateStatus(
            operationId: string,
            status: string,
            metadata?: any,
        ): Promise<void>;
        getProcessingOperations?(
            options?: { limit?: number },
        ): Promise<StoredOperation[]>;
        getFailedOperations?(
            options?: { limit?: number },
        ): Promise<StoredOperation[]>;
        getOperation?(operationId: string): Promise<StoredOperation | null>;
        deleteOperation?(operationId: string): Promise<void>;
    }
    Index

    Methods

    • Stores a new operation in the queue.

      Parameters

      • operation: { id: string; data: any; metadata?: any }

        The operation to store

      Returns Promise<void>

      Promise that resolves when the operation is stored

    • Updates the status of an operation.

      Parameters

      • operationId: string

        The ID of the operation to update

      • status: string

        The new status

      • Optionalmetadata: any

        Optional metadata to store with the update

      Returns Promise<void>

      Promise that resolves when the status is updated

    • Deletes an operation from storage.

      Parameters

      • operationId: string

        The ID of the operation to delete

      Returns Promise<void>

      Promise that resolves when the operation is deleted