Class DocumentStorage
Defined in: warp-drive-packages/experiments/src/document-storage/index.ts:410
DocumentStorage is a wrapper around the StorageManager API that provides a simple interface for reading and updating documents and requests.
Some goals for this experiment:
- optimize for storing requests/documents
- optimize for storing resources
- optimize for looking up resources associated to a document
- optimize for notifying cross-tab when data is updated
optional features:
- support for offline mode
- ?? support for relationship based cache traversal
- a way to index records by type + another field (e.g updatedAt/createAt/name) such that simple queries can be done without having to scan all records
Constructors
Constructor
new DocumentStorage(options?: Partial<DocumentStorageOptions>): DocumentStorage;Defined in: warp-drive-packages/experiments/src/document-storage/index.ts:413
Parameters
options?
Partial<DocumentStorageOptions> = {}
Returns
DocumentStorage
Methods
clear()
clear(reset?: boolean): Promise<void>;Defined in: warp-drive-packages/experiments/src/document-storage/index.ts:451
Parameters
reset?
boolean
Returns
Promise<void>
getDocument()
getDocument(key: DocumentIdentifier): Promise<CacheDocument | null>;Defined in: warp-drive-packages/experiments/src/document-storage/index.ts:433
Parameters
key
DocumentIdentifier
Returns
Promise<CacheDocument | null>
putDocument()
putDocument(document: CacheFileDocument, resourceCollector: (resourceIdentifier: PersistedResourceKey) => ExistingResourceObject): Promise<void>;Defined in: warp-drive-packages/experiments/src/document-storage/index.ts:437
Parameters
document
CacheFileDocument
resourceCollector
(resourceIdentifier: PersistedResourceKey) => ExistingResourceObject
Returns
Promise<void>
putResources()
putResources(document: ResourceDataDocument, resourceCollector: (resourceIdentifier: PersistedResourceKey) => ExistingResourceObject): Promise<void>;Defined in: warp-drive-packages/experiments/src/document-storage/index.ts:444
Parameters
document
resourceCollector
(resourceIdentifier: PersistedResourceKey) => ExistingResourceObject
Returns
Promise<void>
Properties
_storage
readonly _storage: InternalDocumentStorage;Defined in: warp-drive-packages/experiments/src/document-storage/index.ts:411