DocumentStorage

Represents a generic storage system for documents, without the need for additional metadata or payloads. This interface provides basic document storage operations such as storing, retrieving, and deleting documents.

Parameters

Document

The type of document being stored or processed.

By inheriting from DocumentStorageWithPayload with a fixed payload type of Unit, DocumentStorage simplifies the use case for scenarios where no additional payload is required alongside the document.

Inheritors

Functions

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

Iterates over the documents

Link copied to clipboard

Iterates through documents and their corresponding payloads

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

Deletes the document with the specified ID from the storage.

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

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

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

Reads a document associated with the given document ID and returns it.

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

Reads a document along with its associated payload based on the given document ID.

Link copied to clipboard
open suspend fun store(document: Document): String

Stores a document in the storage system without any additional payload.

abstract suspend fun store(document: Document, data: Unit): String

Stores a document and its associated payload in the storage.