FileVectorStorageBackend

A file-system-based implementation of VectorStorageBackend that manages the storage and retrieval of documents and their corresponding vector embeddings within a file system.

Documents and vectors are stored in separate subdirectories under the root path.

Parameters

documentReader

A provider responsible for handling document serialization and deserialization.

fs

A file system provider enabling read and write operations for file storage.

root

Root file path where the storage system will organize data.

Type Parameters

Document

Type representing the document to be stored.

Path

Type representing the file path in the storage system.

Inheritors

Constructors

Link copied to clipboard
constructor(documentReader: DocumentProvider<Path, Document>, fs: FileSystemProvider.ReadWrite<Path>, root: Path)

Functions

Link copied to clipboard
open override fun allDocuments(): Flow<Document>

Retrieves a flow of all documents.

Link copied to clipboard

Retrieves a flow of all documents with their vector embeddings.

Link copied to clipboard
open suspend override fun delete(documentId: String): Boolean

Deletes the document with the specified ID.

Link copied to clipboard
suspend fun getPayload(documentId: String): Vector?

Retrieves the vector payload associated with the document identified by the given document ID.

Link copied to clipboard
open suspend override fun read(documentId: String): Document?

Reads a document by its unique identifier.

Link copied to clipboard
open suspend override fun readWithPayload(documentId: String): DocumentWithPayload<Document, Vector>?

Reads a document along with its vector embedding by document ID.

Link copied to clipboard
open suspend override fun store(document: Document, vector: Vector): String

Stores a document along with its pre-computed vector embedding.

open suspend override fun store(id: String, document: Document, vector: Vector): Boolean

Updates a document along with its pre-computed vector embedding under the specified ID. Only updates if a document with the given ID already exists.