UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

79 lines • 3.35 kB
// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. ========= // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ========= Copyright 2026 @ Strukto.AI All Rights Reserved. ========= import { copy as dbxCopy } from "../../core/databricks_volume/copy.js"; import { create as dbxCreate } from "../../core/databricks_volume/create.js"; import { exists as dbxExists } from "../../core/databricks_volume/exists.js"; import { mkdir as dbxMkdir } from "../../core/databricks_volume/mkdir.js"; import { read as dbxRead } from "../../core/databricks_volume/read.js"; import { readdir as dbxReaddir } from "../../core/databricks_volume/readdir.js"; import { rename as dbxRename } from "../../core/databricks_volume/rename.js"; import { rmRecursive as dbxRmR } from "../../core/databricks_volume/rm.js"; import { rmdir as dbxRmdir } from "../../core/databricks_volume/rmdir.js"; import { stat as dbxStat } from "../../core/databricks_volume/stat.js"; import { readStream as dbxStream } from "../../core/databricks_volume/stream.js"; import { unlink as dbxUnlink } from "../../core/databricks_volume/unlink.js"; import { write as dbxWrite } from "../../core/databricks_volume/write.js"; import { rstripSlash } from "../../utils/slash.js"; import { BaseVFS } from "../base.js"; /** * DatabricksVolume's functions over its accessor, which a host package builds * over its own transport. */ export class DatabricksVolumeVFS extends BaseVFS { readsRanges = true; storageLocation() { const cfg = this.accessor.config; const volume = `/Volumes/${cfg.catalog}/${cfg.schema}/${cfg.volume}`; return `${this.name}:${cfg.host}:${volume}${rstripSlash(cfg.rootPath)}`; } readdir(path, handed) { return dbxReaddir(this.accessor, path, handed?.limit); } read(path, _handed, offset = 0, size = null) { if (offset === 0 && size === null) return dbxStream(this.accessor, path); return dbxRead(this.accessor, path, size === null ? { offset } : { offset, size }); } stat(path) { return dbxStat(this.accessor, path); } exists(path) { return dbxExists(this.accessor, path); } write(path, data) { return dbxWrite(this.accessor, path, data); } create(path) { return dbxCreate(this.accessor, path); } mkdir(path, parents = false) { return dbxMkdir(this.accessor, path, parents); } unlink(path) { return dbxUnlink(this.accessor, path); } rmdir(path) { return dbxRmdir(this.accessor, path); } async rmR(path) { await dbxRmR(this.accessor, path); } rename(src, dst) { return dbxRename(this.accessor, src, dst); } copy(src, dst) { return dbxCopy(this.accessor, src, dst); } } //# sourceMappingURL=databricks_volume.js.map