/** * Provider capability flags used by the storage pipeline to express where media is allowed to live. * * The enum is intentionally bitwise so provider stacks can combine capabilities such as local and remote. */ export declare enum StorageProviderTypeEnum { NONE = 0, LOCAL = 1, REMOTE = 2 } /** * Result returned by a provider after attempting to store media. */ export interface StorageStoreResults { /** * Indicates whether the provider successfully persisted the payload. */ success: boolean; /** * Controls whether the next provider in the controller chain should also receive the same payload. */ processNext: boolean; /** * Optional capability filter that narrows which downstream provider types are allowed to continue processing. */ allowedProviderTypes?: StorageProviderTypeEnum; } /** * Canonical media payload exchanged between the storage controller and concrete providers. */ export interface StorageMediaData { /** * Stable content hash used as the deduplication and lookup key. */ hash: string; /** * Raw source payload to store. A `File` may be preserved when the original filename/metadata matters. */ mediaSource: Blob | File; /** * Library media identifier associated with this payload. */ mediaId: string; name?: string; fileName?: string; mimeType?: string; type?: string; /** * Timestamp indicating when the payload was stored by a provider, when supported. */ storedAt?: number; } /** * Base contract for storage backends used by `StorageController`. * * Implementations decide how media is persisted, synchronized, and retrieved, while the controller * coordinates batching and multi-provider fallback. Providers are expected to be reusable across * project loads, which is why explicit `init` and `destroy` lifecycle hooks are part of the contract. */ export declare abstract class StorageProviderBase { type: StorageProviderTypeEnum; constructor(type: StorageProviderTypeEnum); /** * Creates or rebinds provider resources for a specific project scope. * * @param projectId Project identifier used to isolate persisted media. */ abstract init(projectId: string): Promise; /** * Releases open resources such as IndexedDB handles, sockets, or in-memory caches. */ abstract destroy(): Promise; /** * Synchronizes the provider against a master provider and reports whether the local state was already up to date. * * @param master Source provider considered authoritative for the sync operation. */ abstract sync(master: StorageProviderBase): Promise; /** * Persists media in the provider and decides whether downstream providers should continue processing it. * * @param storageData Media payload to store. */ abstract storeMedia(storageData: StorageMediaData): Promise; /** * Checks whether a media payload identified by its content hash is already present. * * @param mediaHash Content hash to look up. */ abstract hasMedia(mediaHash: string): Promise; /** * Retrieves a stored media payload by content hash. * * @param mediaHash Content hash to resolve. */ abstract getMedia(mediaHash: string): Promise; /** * Removes a stored media payload by content hash. * * @param mediaHash Content hash to remove. */ abstract removeMedia(mediaHash: string): Promise; /** * Lists all stored media hashes known to the provider. */ abstract getMediaHashList(): Promise; /** * Optional hook invoked before a controller begins a grouped batch of storage operations. * * Providers can use this to open temporary connections or transactions that should stay alive * across the whole batch instead of being recreated per request. */ beginBatch(): Promise; /** * Optional hook invoked after a grouped batch of storage operations has completed. */ endBatch(): Promise; /** * Reports whether the provider is currently usable for reads/writes. */ abstract isActive(): boolean; }