import { Accessor } from '@struktoai/mirage-core/accessor/index'; import type { IndexEntry } from '@struktoai/mirage-core/cache/index/config'; import { ResourceName } from '@struktoai/mirage-core/types'; import { type HfRepoConfig } from '../resource/hf_buckets/config.ts'; import type { TreeEntry } from '../core/hf_hub/tree_entry.ts'; export interface RowTables { entries: Map; children: Map; } /** * A mount onto one Hugging Face Hub repository. * * Holds the whole repository tree: the Hub's listing endpoint is recursive, * so one paged walk is the mount's entire listing and every read after it is * a lookup. find and du read that tree directly; everything else goes through * the index it seeds. * * Constructed without touching the network. A constructor cannot await, so * fetching here would mean a blocking client stalling whatever loop the * caller is on; the tree hydrates on first use instead. */ export declare class HfHubAccessor extends Accessor { readonly config: HfRepoConfig; private readonly kind; readonly resourceName: ResourceName; /** The recursive tree, keyed mount-relative with no leading slash and with * keyPrefix already stripped. Reseated by every refill. */ tree: Map; /** Whether that tree is an answer or just the empty default, which is a * different question from whether it holds anything: an empty repository * hydrates to an empty map, and reading that as "not hydrated" refetches it * forever. */ treeLoaded: boolean; /** The index tables derived from that tree, for a mount with no index * wired. Derivation is O(tree), so a readdir loop over a large repo would * be quadratic without a memo; every reseat of `tree` clears it. */ rowsCache: { prefix: string; rows: RowTables; } | null; /** Guards the lazy hydration so concurrent first reads make one request * rather than one per caller. */ hydrating: Promise | null; constructor(config: HfRepoConfig, kind?: string, resourceName?: ResourceName); get repoType(): string; get repoId(): string; get endpoint(): string; get token(): string | undefined; /** * The revision this mount reads. * * Resolved without a request, unlike GitHub's default branch: the Hub * creates every repository with `main` and offers no way to change which * branch is default, so naming no revision means that branch and nothing * has to be asked. */ get revision(): string; /** Normalized WITH a trailing slash, which is what `kp.strip` expects. */ get keyPrefix(): string; get expandCommits(): boolean | undefined; get bucketUri(): string; /** * Lift a mount-relative path to its repo-relative spelling. * * `keyPrefix` is normalized with a TRAILING slash, so joining with one of * our own produced `sub/dir//a.txt` and every read of a prefixed mount * 404'd. */ repoPath(rel: string): string; } export declare class HfModelsHubAccessor extends HfHubAccessor { constructor(config: HfRepoConfig); } export declare class HfDatasetsHubAccessor extends HfHubAccessor { constructor(config: HfRepoConfig); } export declare class HfSpacesHubAccessor extends HfHubAccessor { constructor(config: HfRepoConfig); } //# sourceMappingURL=hf_hub.d.ts.map