@alchemy.run/archil 0.0.0 → 2.0.0-beta.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +57 -4
- package/lib/AWS/S3Disk.d.ts +68 -0
- package/lib/AWS/S3Disk.d.ts.map +1 -0
- package/lib/AWS/S3Disk.js +100 -0
- package/lib/AWS/S3Disk.js.map +1 -0
- package/lib/AWS/index.d.ts +2 -0
- package/lib/AWS/index.d.ts.map +1 -0
- package/lib/AWS/index.js +2 -0
- package/lib/AWS/index.js.map +1 -0
- package/lib/ApiToken.d.ts +63 -0
- package/lib/ApiToken.d.ts.map +1 -0
- package/lib/ApiToken.js +121 -0
- package/lib/ApiToken.js.map +1 -0
- package/lib/ArchilBindings.d.ts +65 -0
- package/lib/ArchilBindings.d.ts.map +1 -0
- package/lib/ArchilBindings.js +128 -0
- package/lib/ArchilBindings.js.map +1 -0
- package/lib/AuthProvider.d.ts +40 -0
- package/lib/AuthProvider.d.ts.map +1 -0
- package/lib/AuthProvider.js +87 -0
- package/lib/AuthProvider.js.map +1 -0
- package/lib/Bootstrap.d.ts +8 -0
- package/lib/Bootstrap.d.ts.map +1 -0
- package/lib/Bootstrap.js +27 -0
- package/lib/Bootstrap.js.map +1 -0
- package/lib/Branch.d.ts +101 -0
- package/lib/Branch.d.ts.map +1 -0
- package/lib/Branch.js +117 -0
- package/lib/Branch.js.map +1 -0
- package/lib/BranchDisk.d.ts +42 -0
- package/lib/BranchDisk.d.ts.map +1 -0
- package/lib/BranchDisk.js +14 -0
- package/lib/BranchDisk.js.map +1 -0
- package/lib/Checkpoint.d.ts +78 -0
- package/lib/Checkpoint.d.ts.map +1 -0
- package/lib/Checkpoint.js +95 -0
- package/lib/Checkpoint.js.map +1 -0
- package/lib/Clients.d.ts +369 -0
- package/lib/Clients.d.ts.map +1 -0
- package/lib/Clients.js +334 -0
- package/lib/Clients.js.map +1 -0
- package/lib/ConnectSandbox.d.ts +69 -0
- package/lib/ConnectSandbox.d.ts.map +1 -0
- package/lib/ConnectSandbox.js +21 -0
- package/lib/ConnectSandbox.js.map +1 -0
- package/lib/Contributions.d.ts +7 -0
- package/lib/Contributions.d.ts.map +1 -0
- package/lib/Contributions.js +6 -0
- package/lib/Contributions.js.map +1 -0
- package/lib/CreateDisk.d.ts +90 -0
- package/lib/CreateDisk.d.ts.map +1 -0
- package/lib/CreateDisk.js +47 -0
- package/lib/CreateDisk.js.map +1 -0
- package/lib/CreateImage.d.ts +42 -0
- package/lib/CreateImage.d.ts.map +1 -0
- package/lib/CreateImage.js +19 -0
- package/lib/CreateImage.js.map +1 -0
- package/lib/CreateSandbox.d.ts +104 -0
- package/lib/CreateSandbox.d.ts.map +1 -0
- package/lib/CreateSandbox.js +98 -0
- package/lib/CreateSandbox.js.map +1 -0
- package/lib/Credentials.d.ts +44 -0
- package/lib/Credentials.d.ts.map +1 -0
- package/lib/Credentials.js +57 -0
- package/lib/Credentials.js.map +1 -0
- package/lib/Disk.d.ts +283 -0
- package/lib/Disk.d.ts.map +1 -0
- package/lib/Disk.js +294 -0
- package/lib/Disk.js.map +1 -0
- package/lib/DiskObjectsHttp.d.ts +20 -0
- package/lib/DiskObjectsHttp.d.ts.map +1 -0
- package/lib/DiskObjectsHttp.js +51 -0
- package/lib/DiskObjectsHttp.js.map +1 -0
- package/lib/DiskUser.d.ts +189 -0
- package/lib/DiskUser.d.ts.map +1 -0
- package/lib/DiskUser.js +243 -0
- package/lib/DiskUser.js.map +1 -0
- package/lib/ExecDisk.d.ts +57 -0
- package/lib/ExecDisk.d.ts.map +1 -0
- package/lib/ExecDisk.js +3 -0
- package/lib/ExecDisk.js.map +1 -0
- package/lib/ExecDiskHttp.d.ts +5 -0
- package/lib/ExecDiskHttp.d.ts.map +1 -0
- package/lib/ExecDiskHttp.js +18 -0
- package/lib/ExecDiskHttp.js.map +1 -0
- package/lib/ExecDisks.d.ts +54 -0
- package/lib/ExecDisks.d.ts.map +1 -0
- package/lib/ExecDisks.js +37 -0
- package/lib/ExecDisks.js.map +1 -0
- package/lib/Image.d.ts +188 -0
- package/lib/Image.d.ts.map +1 -0
- package/lib/Image.js +191 -0
- package/lib/Image.js.map +1 -0
- package/lib/InferEnv.d.ts +26 -0
- package/lib/InferEnv.d.ts.map +1 -0
- package/lib/InferEnv.js +1 -0
- package/lib/InferEnv.js.map +1 -0
- package/lib/MountDisk.d.ts +190 -0
- package/lib/MountDisk.d.ts.map +1 -0
- package/lib/MountDisk.js +227 -0
- package/lib/MountDisk.js.map +1 -0
- package/lib/Providers.d.ts +25 -0
- package/lib/Providers.d.ts.map +1 -0
- package/lib/Providers.js +48 -0
- package/lib/Providers.js.map +1 -0
- package/lib/ReadDisk.d.ts +55 -0
- package/lib/ReadDisk.d.ts.map +1 -0
- package/lib/ReadDisk.js +3 -0
- package/lib/ReadDisk.js.map +1 -0
- package/lib/ReadWriteDisk.d.ts +26 -0
- package/lib/ReadWriteDisk.d.ts.map +1 -0
- package/lib/ReadWriteDisk.js +3 -0
- package/lib/ReadWriteDisk.js.map +1 -0
- package/lib/Sandbox.d.ts +507 -0
- package/lib/Sandbox.d.ts.map +1 -0
- package/lib/Sandbox.js +729 -0
- package/lib/Sandbox.js.map +1 -0
- package/lib/SandboxOptions.d.ts +185 -0
- package/lib/SandboxOptions.d.ts.map +1 -0
- package/lib/SandboxOptions.js +102 -0
- package/lib/SandboxOptions.js.map +1 -0
- package/lib/SandboxPortToken.d.ts +64 -0
- package/lib/SandboxPortToken.d.ts.map +1 -0
- package/lib/SandboxPortToken.js +77 -0
- package/lib/SandboxPortToken.js.map +1 -0
- package/lib/WriteDisk.d.ts +37 -0
- package/lib/WriteDisk.d.ts.map +1 -0
- package/lib/WriteDisk.js +3 -0
- package/lib/WriteDisk.js.map +1 -0
- package/lib/index.d.ts +29 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +28 -0
- package/lib/index.js.map +1 -0
- package/lib/internal/DeployerKey.d.ts +21 -0
- package/lib/internal/DeployerKey.d.ts.map +1 -0
- package/lib/internal/DeployerKey.js +34 -0
- package/lib/internal/DeployerKey.js.map +1 -0
- package/lib/internal/archil.d.ts +87 -0
- package/lib/internal/archil.d.ts.map +1 -0
- package/lib/internal/archil.js +154 -0
- package/lib/internal/archil.js.map +1 -0
- package/lib/internal/hosted.d.ts +90 -0
- package/lib/internal/hosted.d.ts.map +1 -0
- package/lib/internal/hosted.js +291 -0
- package/lib/internal/hosted.js.map +1 -0
- package/package.json +79 -3
- package/src/AWS/S3Disk.ts +125 -0
- package/src/AWS/index.ts +1 -0
- package/src/ApiToken.ts +168 -0
- package/src/ArchilBindings.ts +179 -0
- package/src/AuthProvider.ts +122 -0
- package/src/Bootstrap.ts +54 -0
- package/src/Branch.ts +199 -0
- package/src/BranchDisk.ts +57 -0
- package/src/Checkpoint.ts +145 -0
- package/src/Clients.ts +954 -0
- package/src/ConnectSandbox.ts +91 -0
- package/src/Contributions.ts +9 -0
- package/src/CreateDisk.ts +165 -0
- package/src/CreateImage.ts +73 -0
- package/src/CreateSandbox.ts +258 -0
- package/src/Credentials.ts +101 -0
- package/src/Disk.ts +468 -0
- package/src/DiskObjectsHttp.ts +64 -0
- package/src/DiskUser.ts +369 -0
- package/src/ExecDisk.ts +62 -0
- package/src/ExecDiskHttp.ts +25 -0
- package/src/ExecDisks.ts +100 -0
- package/src/Image.ts +316 -0
- package/src/InferEnv.ts +27 -0
- package/src/MountDisk.ts +466 -0
- package/src/Providers.ts +75 -0
- package/src/ReadDisk.ts +61 -0
- package/src/ReadWriteDisk.ts +31 -0
- package/src/Sandbox.ts +1064 -0
- package/src/SandboxOptions.ts +230 -0
- package/src/SandboxPortToken.ts +125 -0
- package/src/WriteDisk.ts +42 -0
- package/src/globals.d.ts +2 -0
- package/src/index.ts +59 -0
- package/src/internal/DeployerKey.ts +63 -0
- package/src/internal/archil.ts +273 -0
- package/src/internal/hosted.ts +402 -0
package/lib/Disk.d.ts
ADDED
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import * as archil from "@distilled.cloud/archil";
|
|
2
|
+
import * as Provider from "alchemy/Provider";
|
|
3
|
+
import { Resource } from "alchemy/Resource";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import * as Redacted from "effect/Redacted";
|
|
6
|
+
import type { Providers } from "./Providers.ts";
|
|
7
|
+
/**
|
|
8
|
+
* Amazon S3 bucket behind a disk. Omit the keys when the bucket policy
|
|
9
|
+
* trusts Archil's role for the region (see `ArchilAWS.S3Disk`, which writes
|
|
10
|
+
* that policy for you).
|
|
11
|
+
*/
|
|
12
|
+
export interface S3DiskStorage {
|
|
13
|
+
type: "s3";
|
|
14
|
+
/** Bucket name. */
|
|
15
|
+
bucketName: string;
|
|
16
|
+
/** Prefix within the bucket the disk lives under, e.g. `"data/"`. */
|
|
17
|
+
bucketPrefix?: string;
|
|
18
|
+
/** Access key id. Omit for IAM-role access through the bucket policy. */
|
|
19
|
+
accessKeyId?: Redacted.Redacted<string>;
|
|
20
|
+
/** Secret access key. */
|
|
21
|
+
secretAccessKey?: Redacted.Redacted<string>;
|
|
22
|
+
/** Session token for temporary credentials. */
|
|
23
|
+
sessionToken?: Redacted.Redacted<string>;
|
|
24
|
+
}
|
|
25
|
+
/** Google Cloud Storage bucket behind a disk, through HMAC keys. */
|
|
26
|
+
export interface GcsDiskStorage {
|
|
27
|
+
type: "gcs";
|
|
28
|
+
bucketName: string;
|
|
29
|
+
bucketPrefix?: string;
|
|
30
|
+
accessKeyId: Redacted.Redacted<string>;
|
|
31
|
+
secretAccessKey: Redacted.Redacted<string>;
|
|
32
|
+
}
|
|
33
|
+
/** Cloudflare R2 bucket behind a disk. */
|
|
34
|
+
export interface R2DiskStorage {
|
|
35
|
+
type: "r2";
|
|
36
|
+
bucketName: string;
|
|
37
|
+
/** R2 S3 endpoint, `https://<account>.r2.cloudflarestorage.com`. */
|
|
38
|
+
bucketEndpoint: string;
|
|
39
|
+
bucketPrefix?: string;
|
|
40
|
+
accessKeyId: Redacted.Redacted<string>;
|
|
41
|
+
secretAccessKey: Redacted.Redacted<string>;
|
|
42
|
+
}
|
|
43
|
+
/** Any S3-compatible object store behind a disk. */
|
|
44
|
+
export interface S3CompatibleDiskStorage {
|
|
45
|
+
type: "s3-compatible";
|
|
46
|
+
bucketName: string;
|
|
47
|
+
bucketEndpoint: string;
|
|
48
|
+
bucketPrefix?: string;
|
|
49
|
+
accessKeyId: Redacted.Redacted<string>;
|
|
50
|
+
secretAccessKey: Redacted.Redacted<string>;
|
|
51
|
+
}
|
|
52
|
+
/** Azure Blob Storage container behind a disk, through a service principal. */
|
|
53
|
+
export interface AzureBlobDiskStorage {
|
|
54
|
+
type: "azure-blob";
|
|
55
|
+
storageAccount: string;
|
|
56
|
+
containerName: string;
|
|
57
|
+
bucketPrefix?: string;
|
|
58
|
+
tenantId: string;
|
|
59
|
+
clientId: string;
|
|
60
|
+
clientSecret: Redacted.Redacted<string>;
|
|
61
|
+
}
|
|
62
|
+
/** Where a disk's files live. Omit for Archil-managed storage. */
|
|
63
|
+
export type DiskStorage = S3DiskStorage | GcsDiskStorage | R2DiskStorage | S3CompatibleDiskStorage | AzureBlobDiskStorage;
|
|
64
|
+
export interface DiskProps {
|
|
65
|
+
/**
|
|
66
|
+
* Disk name, unique within your Archil account: letters, digits, `-` and
|
|
67
|
+
* `_`, at most 100 characters. If omitted, a unique name is generated
|
|
68
|
+
* from the stack, stage, and logical ID. Changing it replaces the disk.
|
|
69
|
+
*/
|
|
70
|
+
name?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Your own bucket to keep the disk's files in, as ordinary objects any
|
|
73
|
+
* S3 tool can read. Omit for Archil-managed storage. Changing it replaces
|
|
74
|
+
* the disk.
|
|
75
|
+
*/
|
|
76
|
+
storage?: DiskStorage;
|
|
77
|
+
/**
|
|
78
|
+
* IPv4 addresses and CIDR ranges allowed to mount the disk. Empty or
|
|
79
|
+
* omitted allows any address.
|
|
80
|
+
*/
|
|
81
|
+
allowedIps?: string[];
|
|
82
|
+
/**
|
|
83
|
+
* Whether sandboxes and serverless exec may mount the disk.
|
|
84
|
+
* @default true
|
|
85
|
+
*/
|
|
86
|
+
allowSandboxMount?: boolean;
|
|
87
|
+
}
|
|
88
|
+
export interface DiskAttributes {
|
|
89
|
+
/** Disk id (`dsk-…`). */
|
|
90
|
+
diskId: string;
|
|
91
|
+
/** Disk name. */
|
|
92
|
+
name: string;
|
|
93
|
+
/** Archil organization that owns the disk. */
|
|
94
|
+
organization: string;
|
|
95
|
+
/** Archil region the disk lives in, e.g. `aws-us-east-1`. */
|
|
96
|
+
region: string;
|
|
97
|
+
/** Storage backend: `archil` for Archil-managed storage, else the bucket type. */
|
|
98
|
+
storageType: string;
|
|
99
|
+
/** Bucket name, for a disk on your own bucket. */
|
|
100
|
+
bucketName: string | undefined;
|
|
101
|
+
/** Bucket prefix, for a disk on your own bucket. */
|
|
102
|
+
bucketPrefix: string | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* The session id Archil assumes your bucket's role with. Bucket policies
|
|
105
|
+
* can scope access to exactly this disk with
|
|
106
|
+
* `aws:PrincipalTag/archilSessionId`.
|
|
107
|
+
*/
|
|
108
|
+
sessionId: string | undefined;
|
|
109
|
+
/** IPv4 addresses and CIDR ranges allowed to mount the disk. */
|
|
110
|
+
allowedIps: string[];
|
|
111
|
+
/** Whether sandboxes and serverless exec may mount the disk. */
|
|
112
|
+
allowSandboxMount: boolean;
|
|
113
|
+
}
|
|
114
|
+
export type Disk = Resource<"Archil.Disk", DiskProps, DiskAttributes, never, Providers, DiskLookup>;
|
|
115
|
+
/**
|
|
116
|
+
* Props for {@link Disk.lookup}: find a disk this stack
|
|
117
|
+
* doesn't manage by its name.
|
|
118
|
+
*/
|
|
119
|
+
export interface DiskLookup {
|
|
120
|
+
/** Disk name. */
|
|
121
|
+
name: string;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* An Archil disk: a durable filesystem that mounts in about 50 ms on any
|
|
125
|
+
* Linux machine, sandbox, or serverless exec, with hot data on SSD and the
|
|
126
|
+
* rest in object storage. Keep its files in Archil-managed storage, or in
|
|
127
|
+
* your own bucket as ordinary objects.
|
|
128
|
+
*
|
|
129
|
+
* Declare a disk at deploy time for the few long-lived ones an app shares,
|
|
130
|
+
* like a dataset or a seeded base you branch from. Disks that belong to one
|
|
131
|
+
* user, session, or task are created at run time with
|
|
132
|
+
* {@link CreateDisk}, which returns the same disk shape.
|
|
133
|
+
*
|
|
134
|
+
* Archil has no tags, so Alchemy owns a disk through its generated name.
|
|
135
|
+
* A disk with a fixed `name` that already exists is adopted only with
|
|
136
|
+
* `--adopt`.
|
|
137
|
+
*
|
|
138
|
+
* :::caution
|
|
139
|
+
* Changing `name` or `storage` replaces the disk, and destroying a disk on
|
|
140
|
+
* Archil-managed storage deletes its files. A disk on your own bucket
|
|
141
|
+
* leaves the objects in the bucket.
|
|
142
|
+
* :::
|
|
143
|
+
* @see https://docs.archil.com
|
|
144
|
+
*
|
|
145
|
+
* ### Creating a Disk
|
|
146
|
+
* **Example:** Archil-managed storage
|
|
147
|
+
* ```typescript
|
|
148
|
+
* export const Dataset = Archil.Disk("Dataset", {});
|
|
149
|
+
* ```
|
|
150
|
+
*
|
|
151
|
+
* **Example:** On your own S3 bucket, with no keys
|
|
152
|
+
* ```typescript
|
|
153
|
+
* export const Store = AWS.S3.Bucket("Store", {});
|
|
154
|
+
* export const Dataset = ArchilAWS.S3Disk("Dataset", { bucket: Store, prefix: "datasets/" });
|
|
155
|
+
* ```
|
|
156
|
+
*
|
|
157
|
+
* **Example:** On an R2 bucket
|
|
158
|
+
* ```typescript
|
|
159
|
+
* export const Dataset = Archil.Disk("Dataset", {
|
|
160
|
+
* storage: {
|
|
161
|
+
* type: "r2",
|
|
162
|
+
* bucketName: "datasets",
|
|
163
|
+
* bucketEndpoint: "https://<account>.r2.cloudflarestorage.com",
|
|
164
|
+
* accessKeyId: Alchemy.Secret("R2_ACCESS_KEY_ID"),
|
|
165
|
+
* secretAccessKey: Alchemy.Secret("R2_SECRET_ACCESS_KEY"),
|
|
166
|
+
* },
|
|
167
|
+
* });
|
|
168
|
+
* ```
|
|
169
|
+
*
|
|
170
|
+
* ### Restricting Access
|
|
171
|
+
* **Example:** Only mount from known addresses
|
|
172
|
+
* ```typescript
|
|
173
|
+
* export const Dataset = Archil.Disk("Dataset", {
|
|
174
|
+
* allowedIps: ["203.0.113.0/24"],
|
|
175
|
+
* allowSandboxMount: false,
|
|
176
|
+
* });
|
|
177
|
+
* ```
|
|
178
|
+
*
|
|
179
|
+
* ### Binding to a Runtime
|
|
180
|
+
* Object bindings give each host its own S3 user on this disk (read-only
|
|
181
|
+
* for `ReadDisk`), so the host never holds an API key.
|
|
182
|
+
*
|
|
183
|
+
* **Example:** Read and write the disk from a program sandbox
|
|
184
|
+
* ```typescript
|
|
185
|
+
* export default class Api extends Archil.Sandbox<Api>()(
|
|
186
|
+
* "Api",
|
|
187
|
+
* { main: import.meta.url },
|
|
188
|
+
* Effect.gen(function* () {
|
|
189
|
+
* const files = yield* Archil.ReadWriteDisk(Dataset);
|
|
190
|
+
* return {
|
|
191
|
+
* fetch: Effect.map(files.getText("README.md"), (text) => HttpServerResponse.text(text)),
|
|
192
|
+
* };
|
|
193
|
+
* }).pipe(Effect.provide(Archil.ReadWriteDiskHttp)),
|
|
194
|
+
* ) {}
|
|
195
|
+
* ```
|
|
196
|
+
*
|
|
197
|
+
* **Example:** Mount it into a sandbox
|
|
198
|
+
* ```typescript
|
|
199
|
+
* export const Box = Archil.Sandbox("Box", {
|
|
200
|
+
* mounts: [{ disk: Dataset, path: "/data", mode: "read-only" }],
|
|
201
|
+
* });
|
|
202
|
+
* ```
|
|
203
|
+
*
|
|
204
|
+
* **Example:** Mount it in a Cloudflare Container
|
|
205
|
+
* ```typescript
|
|
206
|
+
* const dataset = yield* Archil.MountDisk(Dataset, { path: "/data", mode: "read-only" });
|
|
207
|
+
* const path = yield* dataset.mount();
|
|
208
|
+
* ```
|
|
209
|
+
*
|
|
210
|
+
* ### Runtime Operations
|
|
211
|
+
* **Example:** Run commands and read files
|
|
212
|
+
* ```typescript
|
|
213
|
+
* const dataset = yield* Archil.ExecDisk(Dataset);
|
|
214
|
+
* const files = yield* Archil.ReadDisk(Dataset);
|
|
215
|
+
* const result = yield* dataset.exec("wc -l /mnt/archil/*.csv");
|
|
216
|
+
* const readme = yield* files.getText("README.md");
|
|
217
|
+
* ```
|
|
218
|
+
*
|
|
219
|
+
* **Example:** Upload a large file and share a link
|
|
220
|
+
* ```typescript
|
|
221
|
+
* const files = yield* Archil.ReadWriteDisk(Dataset);
|
|
222
|
+
* yield* files.upload("exports/2026-11.parquet", body);
|
|
223
|
+
* const url = yield* files.share("exports/2026-11.parquet", 3600);
|
|
224
|
+
* ```
|
|
225
|
+
*
|
|
226
|
+
* ### Branches and Checkpoints
|
|
227
|
+
* **Example:** Seed a base, then branch per session
|
|
228
|
+
* ```typescript
|
|
229
|
+
* export const Seed = Archil.Disk("Seed", {});
|
|
230
|
+
* export const SeedBase = Effect.gen(function* () {
|
|
231
|
+
* const seed = yield* Seed;
|
|
232
|
+
* return yield* Archil.Checkpoint("SeedBase", {
|
|
233
|
+
* disk: seed.diskId,
|
|
234
|
+
* name: "base",
|
|
235
|
+
* run: ["git clone https://github.com/acme/app ."],
|
|
236
|
+
* });
|
|
237
|
+
* });
|
|
238
|
+
* // runtime
|
|
239
|
+
* const seeds = yield* Archil.BranchDisk(Seed);
|
|
240
|
+
* const branch = yield* seeds.branch({ name: `session-${id}`, fromCheckpoint: "base" });
|
|
241
|
+
* ```
|
|
242
|
+
*
|
|
243
|
+
* ### Looking up an existing disk
|
|
244
|
+
* `Disk.lookup` references a disk Alchemy doesn't manage (created in
|
|
245
|
+
* the Archil console or by another stack). It is read during plan/deploy,
|
|
246
|
+
* never created, updated or deleted.
|
|
247
|
+
*
|
|
248
|
+
* **Example:** Branch an existing disk
|
|
249
|
+
* ```typescript
|
|
250
|
+
* const data = Archil.Disk.lookup({ name: "datasets" });
|
|
251
|
+
* const preview = yield* Archil.Branch("Preview", { disk: data.diskId });
|
|
252
|
+
* ```
|
|
253
|
+
*
|
|
254
|
+
* @resource
|
|
255
|
+
* @product Disk
|
|
256
|
+
*/
|
|
257
|
+
export declare const Disk: import("alchemy").ResourceClass<Disk>;
|
|
258
|
+
/** The `mounts` entry Archil's create call takes for a storage backend. */
|
|
259
|
+
export declare const toMountConfig: (storage: DiskStorage) => archil.MountConfig;
|
|
260
|
+
/** Map a disk response (and its synced settings) to attributes. */
|
|
261
|
+
export declare const toDiskAttributes: (disk: archil.DiskResponse, settings: {
|
|
262
|
+
allowedIps: string[];
|
|
263
|
+
allowSandboxMount: boolean;
|
|
264
|
+
}) => DiskAttributes;
|
|
265
|
+
/** Read a disk's mount-access settings. */
|
|
266
|
+
export declare const readDiskSettings: (id: string) => Effect.Effect<{
|
|
267
|
+
allowedIps: archil.ApiResponseAllowedIpsDataAllowedIpsList;
|
|
268
|
+
allowSandboxMount: boolean;
|
|
269
|
+
}, archil.ArchilParseError | archil.BadGateway | import("@distilled.cloud/core/errors").BadRequest | archil.ConfigError | import("@distilled.cloud/core/errors").Conflict | import("@distilled.cloud/core/errors").Forbidden | archil.GatewayTimeout | import("effect/http/HttpClientError").HttpClientError | archil.InternalServerError | import("@distilled.cloud/core/protocol-http").InvalidInput | archil.Locked | import("@distilled.cloud/core/errors").NotFound | archil.NotFound | import("@distilled.cloud/core/sdk-error").SdkError | archil.ServiceUnavailable | archil.TooManyRequests | archil.Unauthorized | archil.UnknownArchilError | archil.UnprocessableEntity, archil.ArchilOpContext>;
|
|
270
|
+
/** Converge a disk's mount-access settings to the desired ones. */
|
|
271
|
+
export declare const syncDiskSettings: (id: string, desired: {
|
|
272
|
+
allowedIps?: string[];
|
|
273
|
+
allowSandboxMount?: boolean;
|
|
274
|
+
}) => Effect.Effect<{
|
|
275
|
+
allowedIps: string[];
|
|
276
|
+
allowSandboxMount: boolean;
|
|
277
|
+
}, archil.ArchilParseError | archil.BadGateway | import("@distilled.cloud/core/errors").BadRequest | archil.BadRequest | archil.ConfigError | import("@distilled.cloud/core/errors").Conflict | import("@distilled.cloud/core/errors").Forbidden | archil.GatewayTimeout | import("effect/http/HttpClientError").HttpClientError | archil.InternalServerError | import("@distilled.cloud/core/protocol-http").InvalidInput | archil.Locked | import("@distilled.cloud/core/errors").NotFound | archil.NotFound | import("@distilled.cloud/core/sdk-error").SdkError | archil.ServiceUnavailable | archil.TooManyRequests | archil.Unauthorized | archil.UnknownArchilError | archil.UnprocessableEntity, archil.ArchilOpContext>;
|
|
278
|
+
/** Ensure a disk with this name exists and is available (create-or-observe). */
|
|
279
|
+
export declare const ensureDisk: (name: string, storage: DiskStorage | undefined, knownId?: string | undefined) => Effect.Effect<archil.DiskResponse, import("./index.ts").ArchilFailed | import("./index.ts").ArchilNotReady | archil.ArchilParseError | archil.BadGateway | import("@distilled.cloud/core/errors").BadRequest | archil.BadRequest | archil.ConfigError | import("@distilled.cloud/core/errors").Conflict | import("@distilled.cloud/core/errors").Forbidden | archil.Forbidden | archil.GatewayTimeout | import("effect/http/HttpClientError").HttpClientError | archil.InternalServerError | import("@distilled.cloud/core/protocol-http").InvalidInput | archil.Locked | import("@distilled.cloud/core/errors").NotFound | archil.NotFound | import("@distilled.cloud/core/sdk-error").SdkError | archil.ServiceUnavailable | archil.TooManyRequests | archil.Unauthorized | archil.UnknownArchilError | archil.UnprocessableEntity, archil.ArchilOpContext>;
|
|
280
|
+
/** Delete a disk and wait until it is gone. Deleting a missing disk succeeds. */
|
|
281
|
+
export declare const deleteDisk: (id: string) => Effect.Effect<void, import("./index.ts").ArchilFailed | import("./index.ts").ArchilNotReady | archil.ArchilParseError | archil.BadGateway | import("@distilled.cloud/core/errors").BadRequest | archil.BadRequest | archil.ConfigError | import("@distilled.cloud/core/errors").Conflict | import("@distilled.cloud/core/errors").Forbidden | archil.GatewayTimeout | import("effect/http/HttpClientError").HttpClientError | archil.InternalServerError | import("@distilled.cloud/core/protocol-http").InvalidInput | archil.Locked | import("@distilled.cloud/core/sdk-error").SdkError | archil.ServiceUnavailable | archil.TooManyRequests | archil.Unauthorized | archil.UnknownArchilError | archil.UnprocessableEntity, archil.ArchilOpContext>;
|
|
282
|
+
export declare const DiskProvider: () => import("effect/Layer").Layer<Provider.Provider<Disk>, never, import("alchemy").Stack | import("alchemy").Stage | archil.ArchilOpContext>;
|
|
283
|
+
//# sourceMappingURL=Disk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Disk.d.ts","sources":["../src/Disk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,yBAAyB,CAAC;AAGlD,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAY5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,IAAI,CAAC;IACX,mBAAmB;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yEAAyE;IACzE,WAAW,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACxC,yBAAyB;IACzB,eAAe,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC5C,+CAA+C;IAC/C,YAAY,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;CAC1C;AAED,oEAAoE;AACpE,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,KAAK,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,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f;IAAE,UAAU,EAAE,MAAM,EAAE,CAAC;IAAC,iBAAiB,EAAE,OAAO,CAAA;CAAE,KAC7D,cAgBF,CAAC;AAEF,2CAA2C;AAC3C,eAAO,MAAM,gBAAgB;;;4qBAS3B,CAAC;AAEH,mEAAmE;AACnE,eAAO,MAAM,gBAAgB;iBAEH,MAAM,EAAE;wBAAsB,OAAO;;;;gsBAY7D,CAAC;AAEH,gFAAgF;AAChF,eAAO,MAAM,UAAU,i5BAiBrB,CAAC;AAEH,iFAAiF;AACjF,eAAO,MAAM,UAAU,yuBAGrB,CAAC;AAEH,eAAO,MAAM,YAAY,gJA8DtB,CAAC"}
|
package/lib/Disk.js
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import * as archil from "@distilled.cloud/archil";
|
|
2
|
+
import { Unowned } from "alchemy/AdoptPolicy";
|
|
3
|
+
import { deepEqual, isResolved } from "alchemy/Diff";
|
|
4
|
+
import * as Provider from "alchemy/Provider";
|
|
5
|
+
import { Resource } from "alchemy/Resource";
|
|
6
|
+
import * as Effect from "effect/Effect";
|
|
7
|
+
import * as Redacted from "effect/Redacted";
|
|
8
|
+
import * as Stream from "effect/Stream";
|
|
9
|
+
import { diskName, findDiskByName, getDisk, isAlchemyName, isRuntimeObjectName, waitForDisk, waitForDiskGone, listAllDisks, } from "./internal/archil.js";
|
|
10
|
+
/**
|
|
11
|
+
* An Archil disk: a durable filesystem that mounts in about 50 ms on any
|
|
12
|
+
* Linux machine, sandbox, or serverless exec, with hot data on SSD and the
|
|
13
|
+
* rest in object storage. Keep its files in Archil-managed storage, or in
|
|
14
|
+
* your own bucket as ordinary objects.
|
|
15
|
+
*
|
|
16
|
+
* Declare a disk at deploy time for the few long-lived ones an app shares,
|
|
17
|
+
* like a dataset or a seeded base you branch from. Disks that belong to one
|
|
18
|
+
* user, session, or task are created at run time with
|
|
19
|
+
* {@link CreateDisk}, which returns the same disk shape.
|
|
20
|
+
*
|
|
21
|
+
* Archil has no tags, so Alchemy owns a disk through its generated name.
|
|
22
|
+
* A disk with a fixed `name` that already exists is adopted only with
|
|
23
|
+
* `--adopt`.
|
|
24
|
+
*
|
|
25
|
+
* :::caution
|
|
26
|
+
* Changing `name` or `storage` replaces the disk, and destroying a disk on
|
|
27
|
+
* Archil-managed storage deletes its files. A disk on your own bucket
|
|
28
|
+
* leaves the objects in the bucket.
|
|
29
|
+
* :::
|
|
30
|
+
* @see https://docs.archil.com
|
|
31
|
+
*
|
|
32
|
+
* ### Creating a Disk
|
|
33
|
+
* **Example:** Archil-managed storage
|
|
34
|
+
* ```typescript
|
|
35
|
+
* export const Dataset = Archil.Disk("Dataset", {});
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* **Example:** On your own S3 bucket, with no keys
|
|
39
|
+
* ```typescript
|
|
40
|
+
* export const Store = AWS.S3.Bucket("Store", {});
|
|
41
|
+
* export const Dataset = ArchilAWS.S3Disk("Dataset", { bucket: Store, prefix: "datasets/" });
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* **Example:** On an R2 bucket
|
|
45
|
+
* ```typescript
|
|
46
|
+
* export const Dataset = Archil.Disk("Dataset", {
|
|
47
|
+
* storage: {
|
|
48
|
+
* type: "r2",
|
|
49
|
+
* bucketName: "datasets",
|
|
50
|
+
* bucketEndpoint: "https://<account>.r2.cloudflarestorage.com",
|
|
51
|
+
* accessKeyId: Alchemy.Secret("R2_ACCESS_KEY_ID"),
|
|
52
|
+
* secretAccessKey: Alchemy.Secret("R2_SECRET_ACCESS_KEY"),
|
|
53
|
+
* },
|
|
54
|
+
* });
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* ### Restricting Access
|
|
58
|
+
* **Example:** Only mount from known addresses
|
|
59
|
+
* ```typescript
|
|
60
|
+
* export const Dataset = Archil.Disk("Dataset", {
|
|
61
|
+
* allowedIps: ["203.0.113.0/24"],
|
|
62
|
+
* allowSandboxMount: false,
|
|
63
|
+
* });
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* ### Binding to a Runtime
|
|
67
|
+
* Object bindings give each host its own S3 user on this disk (read-only
|
|
68
|
+
* for `ReadDisk`), so the host never holds an API key.
|
|
69
|
+
*
|
|
70
|
+
* **Example:** Read and write the disk from a program sandbox
|
|
71
|
+
* ```typescript
|
|
72
|
+
* export default class Api extends Archil.Sandbox<Api>()(
|
|
73
|
+
* "Api",
|
|
74
|
+
* { main: import.meta.url },
|
|
75
|
+
* Effect.gen(function* () {
|
|
76
|
+
* const files = yield* Archil.ReadWriteDisk(Dataset);
|
|
77
|
+
* return {
|
|
78
|
+
* fetch: Effect.map(files.getText("README.md"), (text) => HttpServerResponse.text(text)),
|
|
79
|
+
* };
|
|
80
|
+
* }).pipe(Effect.provide(Archil.ReadWriteDiskHttp)),
|
|
81
|
+
* ) {}
|
|
82
|
+
* ```
|
|
83
|
+
*
|
|
84
|
+
* **Example:** Mount it into a sandbox
|
|
85
|
+
* ```typescript
|
|
86
|
+
* export const Box = Archil.Sandbox("Box", {
|
|
87
|
+
* mounts: [{ disk: Dataset, path: "/data", mode: "read-only" }],
|
|
88
|
+
* });
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* **Example:** Mount it in a Cloudflare Container
|
|
92
|
+
* ```typescript
|
|
93
|
+
* const dataset = yield* Archil.MountDisk(Dataset, { path: "/data", mode: "read-only" });
|
|
94
|
+
* const path = yield* dataset.mount();
|
|
95
|
+
* ```
|
|
96
|
+
*
|
|
97
|
+
* ### Runtime Operations
|
|
98
|
+
* **Example:** Run commands and read files
|
|
99
|
+
* ```typescript
|
|
100
|
+
* const dataset = yield* Archil.ExecDisk(Dataset);
|
|
101
|
+
* const files = yield* Archil.ReadDisk(Dataset);
|
|
102
|
+
* const result = yield* dataset.exec("wc -l /mnt/archil/*.csv");
|
|
103
|
+
* const readme = yield* files.getText("README.md");
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* **Example:** Upload a large file and share a link
|
|
107
|
+
* ```typescript
|
|
108
|
+
* const files = yield* Archil.ReadWriteDisk(Dataset);
|
|
109
|
+
* yield* files.upload("exports/2026-11.parquet", body);
|
|
110
|
+
* const url = yield* files.share("exports/2026-11.parquet", 3600);
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* ### Branches and Checkpoints
|
|
114
|
+
* **Example:** Seed a base, then branch per session
|
|
115
|
+
* ```typescript
|
|
116
|
+
* export const Seed = Archil.Disk("Seed", {});
|
|
117
|
+
* export const SeedBase = Effect.gen(function* () {
|
|
118
|
+
* const seed = yield* Seed;
|
|
119
|
+
* return yield* Archil.Checkpoint("SeedBase", {
|
|
120
|
+
* disk: seed.diskId,
|
|
121
|
+
* name: "base",
|
|
122
|
+
* run: ["git clone https://github.com/acme/app ."],
|
|
123
|
+
* });
|
|
124
|
+
* });
|
|
125
|
+
* // runtime
|
|
126
|
+
* const seeds = yield* Archil.BranchDisk(Seed);
|
|
127
|
+
* const branch = yield* seeds.branch({ name: `session-${id}`, fromCheckpoint: "base" });
|
|
128
|
+
* ```
|
|
129
|
+
*
|
|
130
|
+
* ### Looking up an existing disk
|
|
131
|
+
* `Disk.lookup` references a disk Alchemy doesn't manage (created in
|
|
132
|
+
* the Archil console or by another stack). It is read during plan/deploy,
|
|
133
|
+
* never created, updated or deleted.
|
|
134
|
+
*
|
|
135
|
+
* **Example:** Branch an existing disk
|
|
136
|
+
* ```typescript
|
|
137
|
+
* const data = Archil.Disk.lookup({ name: "datasets" });
|
|
138
|
+
* const preview = yield* Archil.Branch("Preview", { disk: data.diskId });
|
|
139
|
+
* ```
|
|
140
|
+
*
|
|
141
|
+
* @resource
|
|
142
|
+
* @product Disk
|
|
143
|
+
*/
|
|
144
|
+
export const Disk = Resource("Archil.Disk");
|
|
145
|
+
const unwrap = (value) => value === undefined ? undefined : typeof value === "string" ? value : Redacted.value(value);
|
|
146
|
+
/** The `mounts` entry Archil's create call takes for a storage backend. */
|
|
147
|
+
export const toMountConfig = (storage) => {
|
|
148
|
+
switch (storage.type) {
|
|
149
|
+
case "s3":
|
|
150
|
+
return {
|
|
151
|
+
type: "s3",
|
|
152
|
+
bucketName: storage.bucketName,
|
|
153
|
+
bucketPrefix: storage.bucketPrefix,
|
|
154
|
+
accessKeyId: unwrap(storage.accessKeyId),
|
|
155
|
+
secretAccessKey: unwrap(storage.secretAccessKey),
|
|
156
|
+
sessionToken: unwrap(storage.sessionToken),
|
|
157
|
+
};
|
|
158
|
+
case "gcs":
|
|
159
|
+
case "r2":
|
|
160
|
+
case "s3-compatible":
|
|
161
|
+
return {
|
|
162
|
+
...storage,
|
|
163
|
+
accessKeyId: unwrap(storage.accessKeyId),
|
|
164
|
+
secretAccessKey: unwrap(storage.secretAccessKey),
|
|
165
|
+
};
|
|
166
|
+
case "azure-blob":
|
|
167
|
+
return { ...storage, clientSecret: unwrap(storage.clientSecret) };
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
/** The comparable identity of a storage backend (no secrets). */
|
|
171
|
+
const storageIdentity = (storage) => storage === undefined
|
|
172
|
+
? undefined
|
|
173
|
+
: {
|
|
174
|
+
type: storage.type,
|
|
175
|
+
bucketName: "bucketName" in storage ? storage.bucketName : undefined,
|
|
176
|
+
bucketPrefix: storage.bucketPrefix,
|
|
177
|
+
bucketEndpoint: "bucketEndpoint" in storage ? storage.bucketEndpoint : undefined,
|
|
178
|
+
containerName: "containerName" in storage ? storage.containerName : undefined,
|
|
179
|
+
storageAccount: "storageAccount" in storage ? storage.storageAccount : undefined,
|
|
180
|
+
};
|
|
181
|
+
/** Map a disk response (and its synced settings) to attributes. */
|
|
182
|
+
export const toDiskAttributes = (disk, settings) => {
|
|
183
|
+
const first = disk.mounts?.[0];
|
|
184
|
+
// Archil-managed storage is an `s3` mount on Archil's own bucket.
|
|
185
|
+
const mount = first?.config?.bucketName?.startsWith("archil.prod.") ? undefined : first;
|
|
186
|
+
return {
|
|
187
|
+
diskId: disk.id,
|
|
188
|
+
name: disk.name,
|
|
189
|
+
organization: disk.organization,
|
|
190
|
+
region: disk.region,
|
|
191
|
+
storageType: mount?.type ?? "archil",
|
|
192
|
+
bucketName: mount?.config?.bucketName,
|
|
193
|
+
bucketPrefix: mount?.config?.bucketPrefix,
|
|
194
|
+
sessionId: mount?.config?.sessionId,
|
|
195
|
+
allowedIps: settings.allowedIps,
|
|
196
|
+
allowSandboxMount: settings.allowSandboxMount,
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
/** Read a disk's mount-access settings. */
|
|
200
|
+
export const readDiskSettings = Effect.fn(function* (id) {
|
|
201
|
+
const [ips, mount] = yield* Effect.all([archil.getAllowedIps({ id }), archil.getSandboxMount({ id })], { concurrency: 2 });
|
|
202
|
+
return {
|
|
203
|
+
allowedIps: ips.data.allowedIps ?? [],
|
|
204
|
+
allowSandboxMount: mount.data.allowSandboxMount,
|
|
205
|
+
};
|
|
206
|
+
});
|
|
207
|
+
/** Converge a disk's mount-access settings to the desired ones. */
|
|
208
|
+
export const syncDiskSettings = Effect.fn(function* (id, desired) {
|
|
209
|
+
const observed = yield* readDiskSettings(id);
|
|
210
|
+
const allowedIps = desired.allowedIps ?? [];
|
|
211
|
+
const allowSandboxMount = desired.allowSandboxMount ?? true;
|
|
212
|
+
if (!deepEqual([...observed.allowedIps].sort(), [...allowedIps].sort())) {
|
|
213
|
+
yield* archil.setAllowedIps({ id, allowedIps });
|
|
214
|
+
}
|
|
215
|
+
if (observed.allowSandboxMount !== allowSandboxMount) {
|
|
216
|
+
yield* archil.setSandboxMount({ id, allowSandboxMount });
|
|
217
|
+
}
|
|
218
|
+
return { allowedIps, allowSandboxMount };
|
|
219
|
+
});
|
|
220
|
+
/** Ensure a disk with this name exists and is available (create-or-observe). */
|
|
221
|
+
export const ensureDisk = Effect.fn(function* (name, storage, knownId) {
|
|
222
|
+
const found = (knownId ? yield* getDisk(knownId) : undefined) ?? (yield* findDiskByName(name));
|
|
223
|
+
// A disk still being deleted (an earlier destroy) holds the name: let it go.
|
|
224
|
+
if (found?.status === "deleting")
|
|
225
|
+
yield* waitForDiskGone(found.id);
|
|
226
|
+
const observed = found?.status === "deleting" ? undefined : found;
|
|
227
|
+
if (observed)
|
|
228
|
+
return yield* waitForDisk(observed.id);
|
|
229
|
+
// Archil answers a create of an existing name with that disk's id, so a
|
|
230
|
+
// concurrent create of the same name needs no special case.
|
|
231
|
+
const { data } = yield* archil.createDisk({
|
|
232
|
+
name,
|
|
233
|
+
mounts: storage ? [toMountConfig(storage)] : undefined,
|
|
234
|
+
});
|
|
235
|
+
return yield* waitForDisk(data.diskId);
|
|
236
|
+
});
|
|
237
|
+
/** Delete a disk and wait until it is gone. Deleting a missing disk succeeds. */
|
|
238
|
+
export const deleteDisk = Effect.fn(function* (id) {
|
|
239
|
+
yield* archil.deleteDisk({ id }).pipe(Effect.catchTag("NotFound", () => Effect.void));
|
|
240
|
+
yield* waitForDiskGone(id);
|
|
241
|
+
});
|
|
242
|
+
export const DiskProvider = () => Provider.effect(Disk, Effect.gen(function* () {
|
|
243
|
+
return {
|
|
244
|
+
stables: ["diskId", "name", "organization", "region", "storageType"],
|
|
245
|
+
list: Effect.fn(function* () {
|
|
246
|
+
const disks = yield* Stream.runCollect(listAllDisks());
|
|
247
|
+
return yield* Effect.forEach(disks.filter((disk) => (isAlchemyName(disk.name) || isRuntimeObjectName(disk.name)) &&
|
|
248
|
+
disk.status !== "deleted"), (disk) => readDiskSettings(disk.id).pipe(Effect.map((s) => toDiskAttributes(disk, s))), { concurrency: 4 });
|
|
249
|
+
}),
|
|
250
|
+
diff: Effect.fn(function* ({ id, olds, news, output }) {
|
|
251
|
+
if (!isResolved(news))
|
|
252
|
+
return undefined;
|
|
253
|
+
const name = output?.name ?? (yield* diskName(id, olds?.name));
|
|
254
|
+
if (news.name !== undefined && news.name !== name) {
|
|
255
|
+
return { action: "replace" };
|
|
256
|
+
}
|
|
257
|
+
if (!deepEqual(storageIdentity(news.storage), storageIdentity(olds?.storage))) {
|
|
258
|
+
return { action: "replace" };
|
|
259
|
+
}
|
|
260
|
+
return undefined;
|
|
261
|
+
}),
|
|
262
|
+
lookup: Effect.fn(function* ({ name }) {
|
|
263
|
+
const disk = yield* findDiskByName(name);
|
|
264
|
+
return disk ? toDiskAttributes(disk, yield* readDiskSettings(disk.id)) : undefined;
|
|
265
|
+
}),
|
|
266
|
+
read: Effect.fn(function* ({ id, olds, output }) {
|
|
267
|
+
const name = output?.name ?? (yield* diskName(id, olds?.name));
|
|
268
|
+
const disk = (output ? yield* getDisk(output.diskId) : undefined) ?? (yield* findDiskByName(name));
|
|
269
|
+
if (!disk)
|
|
270
|
+
return undefined;
|
|
271
|
+
const attrs = toDiskAttributes(disk, yield* readDiskSettings(disk.id));
|
|
272
|
+
// A generated name carries this resource's instance suffix, so a
|
|
273
|
+
// disk with that name is ours even when state was lost. A fixed
|
|
274
|
+
// name may belong to anyone.
|
|
275
|
+
if (output === undefined && olds?.name !== undefined && !isAlchemyName(disk.name)) {
|
|
276
|
+
return Unowned(attrs);
|
|
277
|
+
}
|
|
278
|
+
return attrs;
|
|
279
|
+
}),
|
|
280
|
+
reconcile: Effect.fn(function* ({ id, news, output, session }) {
|
|
281
|
+
// Observe + ensure
|
|
282
|
+
const name = output?.name ?? (yield* diskName(id, news.name));
|
|
283
|
+
yield* session.note(`Ensuring disk ${name}...`);
|
|
284
|
+
const disk = yield* ensureDisk(name, news.storage, output?.diskId);
|
|
285
|
+
// Sync
|
|
286
|
+
const settings = yield* syncDiskSettings(disk.id, news);
|
|
287
|
+
return toDiskAttributes(disk, settings);
|
|
288
|
+
}),
|
|
289
|
+
delete: Effect.fn(function* ({ output }) {
|
|
290
|
+
yield* deleteDisk(output.diskId);
|
|
291
|
+
}),
|
|
292
|
+
};
|
|
293
|
+
}));
|
|
294
|
+
//# sourceMappingURL=Disk.js.map
|
package/lib/Disk.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Disk.js","sources":["../src/Disk.ts"],"names":[],"mappings":"AAAA,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AM,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE;YAC3D,mBAAmB;YACnB,MAAM,IAAI,GAAG,MAAM,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YAC9D,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,IAAI,KAAK,CAAC,CAAC;YAChD,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;YACnE,OAAO;YACP,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;YACxD,OAAO,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC1C,CAAC,CAAC;QACF,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE;YACrC,KAAK,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACnC,CAAC,CAAC;KACH,CAAC;AACJ,CAAC,CAAC,CACH,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as Layer from "effect/Layer";
|
|
2
|
+
import { ReadDisk } from "./ReadDisk.ts";
|
|
3
|
+
import { ReadWriteDisk } from "./ReadWriteDisk.ts";
|
|
4
|
+
import { WriteDisk } from "./WriteDisk.ts";
|
|
5
|
+
/**
|
|
6
|
+
* {@link ReadDisk} over Archil's S3-compatible API, usable from any host.
|
|
7
|
+
* The host gets a read-only S3 user on the disk.
|
|
8
|
+
*/
|
|
9
|
+
export declare const ReadDiskHttp: Layer.Layer<ReadDisk, never, never>;
|
|
10
|
+
/**
|
|
11
|
+
* {@link WriteDisk} over Archil's S3-compatible API, usable from any host.
|
|
12
|
+
* The host gets a read-write S3 user on the disk.
|
|
13
|
+
*/
|
|
14
|
+
export declare const WriteDiskHttp: Layer.Layer<WriteDisk, never, never>;
|
|
15
|
+
/**
|
|
16
|
+
* {@link ReadWriteDisk} over Archil's S3-compatible API, usable from any
|
|
17
|
+
* host. The host gets a read-write S3 user on the disk.
|
|
18
|
+
*/
|
|
19
|
+
export declare const ReadWriteDiskHttp: Layer.Layer<ReadWriteDisk, never, never>;
|
|
20
|
+
//# sourceMappingURL=DiskObjectsHttp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DiskObjectsHttp.d.ts","sources":["../src/DiskObjectsHttp.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAItC,OAAO,EAAE,QAAQ,EAA2B,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAO3C;;;GAGG;AACH,eAAO,MAAM,YAAY,qCAUxB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,sCAUzB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,0CAa7B,CAAC"}
|