文章标题:Vercel Drives 现已支持命名快照
正文: 现在你可以为 Vercel Drive 创建命名快照。每个快照都是创建时驱动器内容的只读副本。之后对驱动器的写入不会改变它。你可以同时将快照挂载到多个沙箱中,或将其 fork 为新的可写驱动器,从该时间点继续工作。
在此之前,驱动器快照的生命周期仅与挂载它的沙箱一样长。drive.snapshot() 仍然保持这种方式。
使用 Vercel CLI 68.3.0 或更高版本,运行:
vercel drives snapshot workspace-cache baselinevercel drives snapshots list workspace-cachevercel drives snapshots fork baseline workspace-cache-restored --drive workspace-cache
使用 Vercel CLI 创建、列出和 fork 命名快照。
更新 TypeScript 的 @vercel/drives 和 @vercel/sandbox,或 Python 的 vercel-drives 和 vercel-sandbox,然后运行:
import { Drive } from '@vercel/drives';import { Sandbox } from '@vercel/sandbox';
const drive = await Drive.get({ name: 'workspace-cache' });const snapshot = await drive.snapshot({ name: 'baseline' });
const sandbox = await Sandbox.create({ region: snapshot.region, mounts: { '/data': snapshot },});
const restored = await snapshot.fork({ name: 'workspace-cache-restored' });
使用 TypeScript SDK 创建、挂载和 fork 命名快照。
每个命名快照按其已使用大小作为驱动器存储计费,直到你将其删除。你还可以在 Vercel 仪表板中查看和删除驱动器的命名快照。
命名快照与 Sandbox 快照是分开的,后者保存沙箱的整个文件系统。了解何时使用 Drives 与 Sandbox 快照。
命名快照适用于 Hobby、Pro 和 Enterprise 计划。在 Drives 文档中了解更多。