/** * Storage Registry * * Manages multiple storage controllers for Rebase backend. * Allows different storage backends for different use cases. * * Usage: * - Single storage: Pass a single StorageController → maps to "(default)" * - Multiple storages: Pass a map of { storageId: StorageController } * - String properties use `storageId` in their config to specify which storage to use * - Properties without `storageId` fallback to "(default)" */ import { StorageController } from "./types"; /** * The default storage identifier used when: * - A single storage controller is provided (not a map) * - A property doesn't specify a storageId */ export declare const DEFAULT_STORAGE_ID = "(default)"; /** * Registry for managing multiple storage controllers */ export interface StorageRegistry { /** * Register a storage controller with an ID * @param id - Unique identifier for this storage (e.g., "media", "backups") * @param controller - The StorageController instance */ register(id: string, controller: StorageController): void; /** * Get the default storage controller (id = "(default)") * @throws Error if no default storage is registered */ getDefault(): StorageController; /** * Get a storage controller by ID * @param id - Storage identifier, or undefined/null for default * @returns The StorageController, or undefined if not found */ get(id: string | undefined | null): StorageController | undefined; /** * Get a storage controller by ID, with fallback to default * @param id - Storage identifier, or undefined/null for default * @returns The StorageController (falls back to default if id not found) * @throws Error if neither the specified nor default storage exists */ getOrDefault(id: string | undefined | null): StorageController; /** * Check if a storage with the given ID exists */ has(id: string): boolean; /** * List all registered storage IDs */ list(): string[]; /** * Get the number of registered storage controllers */ size(): number; } /** * Default implementation of StorageRegistry */ export declare class DefaultStorageRegistry implements StorageRegistry { private controllers; /** * Create a StorageRegistry from either a single controller or a map * @param input - Single StorageController (maps to "(default)") or Record */ static create(input: StorageController | Record): DefaultStorageRegistry; register(id: string, controller: StorageController): void; getDefault(): StorageController; get(id: string | undefined | null): StorageController | undefined; getOrDefault(id: string | undefined | null): StorageController; has(id: string): boolean; list(): string[]; size(): number; }