Skip to content

Commit 2f04e4f

Browse files
committed
Add refreshable creds
1 parent b3428c9 commit 2f04e4f

File tree

4 files changed

+348
-130
lines changed

4 files changed

+348
-130
lines changed

Cargo.lock

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

icechunk-js/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ tokio = { version = "1", features = ["sync"] }
1515
bytes = "1"
1616
futures = "0.3"
1717
serde_json = "1"
18+
serde = { version = "1.0.228", features = ["derive", "rc"] }
1819
chrono = "0.4"
20+
async-trait = "0.1.89"
21+
typetag = "0.2.21"
22+
rand = "0.10.0"
1923

2024
[target.'cfg(not(target_family = "wasm"))'.dependencies]
2125
icechunk = { path = "../icechunk" }

icechunk-js/index.d.ts

Lines changed: 1 addition & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,11 @@ export declare class Session {
2323
get store(): JsStore
2424
commit(message: string): Promise<string>
2525
discardChanges(): Promise<void>
26-
/** Get all virtual chunk locations referenced by this session */
27-
allVirtualChunkLocations(): Promise<Array<string>>
2826
}
2927
export type JsSession = Session
3028

3129
export declare class Storage {
3230
static newInMemory(): Promise<Storage>
33-
static newLocalFilesystem(path: string): Promise<Storage>
34-
static newS3(bucket: string, prefix?: string | undefined | null, credentials?: S3Credentials | undefined | null, options?: S3Options | undefined | null): Storage
35-
static newR2(bucket?: string | undefined | null, prefix?: string | undefined | null, accountId?: string | undefined | null, credentials?: S3Credentials | undefined | null, options?: S3Options | undefined | null): Storage
36-
static newTigris(bucket: string, prefix?: string | undefined | null, credentials?: S3Credentials | undefined | null, options?: S3Options | undefined | null, useWeakConsistency?: boolean | undefined | null): Storage
37-
static newS3ObjectStore(bucket: string, prefix?: string | undefined | null, credentials?: S3Credentials | undefined | null, options?: S3Options | undefined | null): Promise<Storage>
38-
static newGcs(bucket: string, prefix?: string | undefined | null, credentials?: GcsCredentials | undefined | null, config?: Record<string, string> | undefined | null): Storage
39-
static newAzureBlob(account: string, container: string, prefix?: string | undefined | null, credentials?: AzureCredentials | undefined | null, config?: Record<string, string> | undefined | null): Promise<Storage>
40-
static newHttp(baseUrl: string, config?: Record<string, string> | undefined | null): Storage
4131
}
4232
export type JsStorage = Storage
4333

@@ -53,32 +43,9 @@ export declare class Store {
5343
get supportsWrites(): boolean
5444
get supportsDeletes(): boolean
5545
get supportsListing(): boolean
56-
/**
57-
* Set a single virtual reference to a chunk
58-
*
59-
* For checksum validation, provide either etag_checksum (string) or last_modified (JS Date object).
60-
* If both are provided, etag_checksum takes precedence.
61-
*/
62-
setVirtualRef(key: string, location: string, offset: number, length: number, etagChecksum: string | undefined | null, lastModified: Date | undefined | null, validateContainer: boolean): Promise<void>
63-
/**
64-
* Set multiple virtual references for the same array
65-
* Returns the indices of failed chunk references if any
66-
*/
67-
setVirtualRefs(arrayPath: string, chunks: Array<VirtualChunkSpec>, validateContainers: boolean): Promise<Array<Array<number>> | null>
6846
}
6947
export type JsStore = Store
7048

71-
/** Azure credentials */
72-
export type AzureCredentials =
73-
| { type: 'FromEnv' }
74-
| { type: 'Static', field0: AzureStaticCredentials }
75-
76-
/** Azure static credentials */
77-
export type AzureStaticCredentials =
78-
| { type: 'AccessKey', field0: string }
79-
| { type: 'SasToken', field0: string }
80-
| { type: 'BearerToken', field0: string }
81-
8249
/** Caching configuration */
8350
export interface CachingConfig {
8451
numSnapshotNodes?: number
@@ -99,70 +66,19 @@ export interface CompressionConfig {
9966
level?: number
10067
}
10168

102-
/** Credentials for virtual chunk access */
103-
export type Credentials =
104-
| { type: 'S3', field0: S3Credentials }
105-
| { type: 'Gcs', field0: GcsCredentials }
106-
| { type: 'Azure', field0: AzureCredentials }
107-
108-
/** GCS credentials */
109-
export type GcsCredentials =
110-
| { type: 'Anonymous' }
111-
| { type: 'FromEnv' }
112-
| { type: 'Static', field0: GcsStaticCredentials }
113-
114-
/** GCS static credentials */
115-
export type GcsStaticCredentials =
116-
| { type: 'ServiceAccount', field0: string }
117-
| { type: 'ServiceAccountKey', field0: string }
118-
| { type: 'ApplicationCredentials', field0: string }
119-
| { type: 'BearerToken', field0: string }
120-
12169
export interface ManifestFileInfo {
12270
id: string
12371
sizeBytes: number
12472
numChunkRefs: number
12573
}
12674

127-
/** Object store configuration for virtual chunk containers */
128-
export type ObjectStoreConfig =
129-
| { type: 'InMemory' }
130-
| { type: 'LocalFileSystem', field0: string }
131-
| { type: 'Http', field0: Record<string, string> }
132-
| { type: 'S3Compatible', field0: S3Options }
133-
| { type: 'S3', field0: S3Options }
134-
| { type: 'Gcs', field0: Record<string, string> }
135-
| { type: 'Azure', field0: Record<string, string> }
136-
| { type: 'Tigris', field0: S3Options }
137-
13875
export interface ReadonlySessionOptions {
13976
branch?: string
14077
tag?: string
14178
snapshotId?: string
14279
}
14380

144-
/**
145-
* Repository configuration
146-
*
147-
* The `manifest` field accepts a JSON object matching the serde serialization
148-
* of `ManifestConfig`. Example:
149-
* ```js
150-
* {
151-
* manifest: {
152-
* preload: {
153-
* max_total_refs: 1000,
154-
* preload_if: { true: null },
155-
* max_arrays_to_scan: 10
156-
* },
157-
* splitting: {
158-
* split_sizes: [
159-
* [{ path_matches: { regex: ".*" } }, [{ condition: "any", num_chunks: 100 }]]
160-
* ]
161-
* }
162-
* }
163-
* }
164-
* ```
165-
*/
81+
/** Repository configuration (WASM build — no virtual chunk support) */
16682
export interface RepositoryConfig {
16783
inlineChunkThresholdBytes?: number
16884
getPartialValuesConcurrency?: number
@@ -175,32 +91,6 @@ export interface RepositoryConfig {
17591
* The object is deserialized using serde, matching the Rust ManifestConfig structure.
17692
*/
17793
manifest?: any
178-
/** Virtual chunk containers configuration (non-WASM only) */
179-
virtualChunkContainers?: Record<string, VirtualChunkContainer>
180-
}
181-
182-
/** S3 credentials */
183-
export type S3Credentials =
184-
| { type: 'FromEnv' }
185-
| { type: 'Anonymous' }
186-
| { type: 'Static', field0: S3StaticCredentials }
187-
188-
/** S3 options */
189-
export interface S3Options {
190-
region?: string
191-
endpointUrl?: string
192-
allowHttp?: boolean
193-
anonymous?: boolean
194-
forcePathStyle?: boolean
195-
networkStreamTimeoutSeconds?: number
196-
requesterPays?: boolean
197-
}
198-
199-
/** S3 static credentials */
200-
export interface S3StaticCredentials {
201-
accessKeyId: string
202-
secretAccessKey: string
203-
sessionToken?: string
20494
}
20595

20696
/** Storage concurrency settings */
@@ -228,21 +118,3 @@ export interface StorageSettings {
228118
chunksStorageClass?: string
229119
minimumSizeForMultipartUpload?: number
230120
}
231-
232-
/** Virtual chunk container configuration */
233-
export interface VirtualChunkContainer {
234-
name?: string
235-
urlPrefix: string
236-
store: JsObjectStoreConfig
237-
}
238-
239-
/** Specification for a virtual chunk reference */
240-
export interface VirtualChunkSpec {
241-
index: Array<number>
242-
location: string
243-
offset: number
244-
length: number
245-
etagChecksum?: string
246-
/** Last modified datetime (accepts JS Date object) */
247-
lastModified?: Date
248-
}

0 commit comments

Comments
 (0)