import type { AbsolutePath, RangeQuery } from "zarrita"; import { AsyncReadable } from "zarrita"; import { IPFSELEMENTS_INTERFACE } from "./ipfs-elements"; /** * Type definition for the root object (manifest) of the sharded store. */ export type ShardedRoot = { manifest_version: "sharded_zarr_v1"; /** A map of metadata keys (e.g., '.zattrs', 'zarr.json') to their CIDs. */ metadata: Record; /** Information about the sharded chunk index. */ chunks: { array_shape: number[]; chunk_shape: number[]; sharding_config: { chunks_per_shard: number; }; /** A list of CIDs, where each CID points to a DAG-CBOR shard of the chunk index. */ shard_cids: (string | null)[]; }; }; /** * A read-only Zarr Store implementation that uses a sharded layout for chunk indices. * * This store reads a Zarr array where the chunk index is split into multiple "shards". * Each shard is a DAG-CBOR encoded list containing CIDs for a subset of chunks, or null * for empty chunks. This aligns with modern IPLD data structures. */ export declare class ShardedStore implements AsyncReadable { readonly readOnly = true; ipfsElements: IPFSELEMENTS_INTERFACE; private rootCid; private rootObj?; private shardDataCache; private pendingShardLoads; private metadataCache; private arrayShape?; private chunkShape?; private chunksPerDim?; private chunksPerShard?; private numShards?; private totalChunks?; /** * Private constructor. Use the static `open` method to create an instance. */ private constructor(); /** * Asynchronously opens an existing read-only ShardedStore. */ static open(rootCid: string, ipfsElements: IPFSELEMENTS_INTERFACE): Promise; static fromRootObject(rootCid: string, ipfsElements: IPFSELEMENTS_INTERFACE, rootObj: ShardedRoot): ShardedStore; private loadRootFromCid; private initializeRootObject; /** Parses a Zarr key to determine if it's a chunk key and returns its coordinates. */ private parseChunkKey; /** Converts N-D chunk coordinates to a 1-D linear index. */ private getLinearChunkIndex; /** Calculates the shard index and the index within the shard for a chunk. */ private getShardInfo; /** * Retrieves a value from the store. Handles both metadata and chunk data. */ get(key: string): Promise; /** Checks if a key exists in the store. */ has(key: AbsolutePath): Promise; /** * Encapsulates the logic to get a decoded shard from cache or load it. */ private getOrLoadDecodedShard; /** * Loads, decodes, and caches a single shard. */ private loadAndCacheShard; /** * List all metadata keys available in this store * Required by ZarrBackend for discovery */ listMetadataKeys(): string[]; set(_key: AbsolutePath, _value: Uint8Array): Promise; delete(_key: AbsolutePath): Promise; getRange?(_key: AbsolutePath, _range: RangeQuery): Promise; } //# sourceMappingURL=sharded-store.d.ts.map