gitx.do 0.0.3 → 0.1.1
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/README.md +319 -92
- package/dist/cli/commands/add.d.ts +176 -0
- package/dist/cli/commands/add.d.ts.map +1 -0
- package/dist/cli/commands/add.js +979 -0
- package/dist/cli/commands/add.js.map +1 -0
- package/dist/cli/commands/blame.d.ts +1 -1
- package/dist/cli/commands/blame.d.ts.map +1 -1
- package/dist/cli/commands/blame.js +1 -1
- package/dist/cli/commands/blame.js.map +1 -1
- package/dist/cli/commands/branch.d.ts +1 -1
- package/dist/cli/commands/branch.d.ts.map +1 -1
- package/dist/cli/commands/branch.js +2 -2
- package/dist/cli/commands/branch.js.map +1 -1
- package/dist/cli/commands/checkout.d.ts +73 -0
- package/dist/cli/commands/checkout.d.ts.map +1 -0
- package/dist/cli/commands/checkout.js +725 -0
- package/dist/cli/commands/checkout.js.map +1 -0
- package/dist/cli/commands/commit.d.ts.map +1 -1
- package/dist/cli/commands/commit.js +22 -2
- package/dist/cli/commands/commit.js.map +1 -1
- package/dist/cli/commands/diff.d.ts +4 -4
- package/dist/cli/commands/diff.d.ts.map +1 -1
- package/dist/cli/commands/diff.js +9 -8
- package/dist/cli/commands/diff.js.map +1 -1
- package/dist/cli/commands/log.d.ts +1 -1
- package/dist/cli/commands/log.d.ts.map +1 -1
- package/dist/cli/commands/log.js +1 -1
- package/dist/cli/commands/log.js.map +1 -1
- package/dist/cli/commands/merge.d.ts +106 -0
- package/dist/cli/commands/merge.d.ts.map +1 -0
- package/dist/cli/commands/merge.js +852 -0
- package/dist/cli/commands/merge.js.map +1 -0
- package/dist/cli/commands/review.d.ts +1 -1
- package/dist/cli/commands/review.d.ts.map +1 -1
- package/dist/cli/commands/review.js +26 -1
- package/dist/cli/commands/review.js.map +1 -1
- package/dist/cli/commands/stash.d.ts +157 -0
- package/dist/cli/commands/stash.d.ts.map +1 -0
- package/dist/cli/commands/stash.js +655 -0
- package/dist/cli/commands/stash.js.map +1 -0
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +1 -2
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/web.d.ts.map +1 -1
- package/dist/cli/commands/web.js +3 -2
- package/dist/cli/commands/web.js.map +1 -1
- package/dist/cli/fs-adapter.d.ts.map +1 -1
- package/dist/cli/fs-adapter.js +3 -5
- package/dist/cli/fs-adapter.js.map +1 -1
- package/dist/cli/fsx-cli-adapter.d.ts +359 -0
- package/dist/cli/fsx-cli-adapter.d.ts.map +1 -0
- package/dist/cli/fsx-cli-adapter.js +619 -0
- package/dist/cli/fsx-cli-adapter.js.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +68 -12
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/ui/components/DiffView.d.ts +7 -2
- package/dist/cli/ui/components/DiffView.d.ts.map +1 -1
- package/dist/cli/ui/components/DiffView.js.map +1 -1
- package/dist/cli/ui/components/ErrorDisplay.d.ts +6 -2
- package/dist/cli/ui/components/ErrorDisplay.d.ts.map +1 -1
- package/dist/cli/ui/components/ErrorDisplay.js.map +1 -1
- package/dist/cli/ui/components/FuzzySearch.d.ts +8 -2
- package/dist/cli/ui/components/FuzzySearch.d.ts.map +1 -1
- package/dist/cli/ui/components/FuzzySearch.js.map +1 -1
- package/dist/cli/ui/components/LoadingSpinner.d.ts +6 -2
- package/dist/cli/ui/components/LoadingSpinner.d.ts.map +1 -1
- package/dist/cli/ui/components/LoadingSpinner.js.map +1 -1
- package/dist/cli/ui/components/NavigationList.d.ts +7 -2
- package/dist/cli/ui/components/NavigationList.d.ts.map +1 -1
- package/dist/cli/ui/components/NavigationList.js.map +1 -1
- package/dist/cli/ui/components/ScrollableContent.d.ts +7 -2
- package/dist/cli/ui/components/ScrollableContent.d.ts.map +1 -1
- package/dist/cli/ui/components/ScrollableContent.js.map +1 -1
- package/dist/cli/ui/terminal-ui.d.ts +42 -9
- package/dist/cli/ui/terminal-ui.d.ts.map +1 -1
- package/dist/cli/ui/terminal-ui.js.map +1 -1
- package/dist/do/BashModule.d.ts +871 -0
- package/dist/do/BashModule.d.ts.map +1 -0
- package/dist/do/BashModule.js +1143 -0
- package/dist/do/BashModule.js.map +1 -0
- package/dist/do/FsModule.d.ts +612 -0
- package/dist/do/FsModule.d.ts.map +1 -0
- package/dist/do/FsModule.js +1120 -0
- package/dist/do/FsModule.js.map +1 -0
- package/dist/do/GitModule.d.ts +635 -0
- package/dist/do/GitModule.d.ts.map +1 -0
- package/dist/do/GitModule.js +784 -0
- package/dist/do/GitModule.js.map +1 -0
- package/dist/do/GitRepoDO.d.ts +281 -0
- package/dist/do/GitRepoDO.d.ts.map +1 -0
- package/dist/do/GitRepoDO.js +479 -0
- package/dist/do/GitRepoDO.js.map +1 -0
- package/dist/do/bash-ast.d.ts +246 -0
- package/dist/do/bash-ast.d.ts.map +1 -0
- package/dist/do/bash-ast.js +888 -0
- package/dist/do/bash-ast.js.map +1 -0
- package/dist/do/container-executor.d.ts +491 -0
- package/dist/do/container-executor.d.ts.map +1 -0
- package/dist/do/container-executor.js +731 -0
- package/dist/do/container-executor.js.map +1 -0
- package/dist/do/index.d.ts +53 -0
- package/dist/do/index.d.ts.map +1 -0
- package/dist/do/index.js +91 -0
- package/dist/do/index.js.map +1 -0
- package/dist/do/tiered-storage.d.ts +403 -0
- package/dist/do/tiered-storage.d.ts.map +1 -0
- package/dist/do/tiered-storage.js +689 -0
- package/dist/do/tiered-storage.js.map +1 -0
- package/dist/do/withBash.d.ts +231 -0
- package/dist/do/withBash.d.ts.map +1 -0
- package/dist/do/withBash.js +244 -0
- package/dist/do/withBash.js.map +1 -0
- package/dist/do/withFs.d.ts +237 -0
- package/dist/do/withFs.d.ts.map +1 -0
- package/dist/do/withFs.js +387 -0
- package/dist/do/withFs.js.map +1 -0
- package/dist/do/withGit.d.ts +180 -0
- package/dist/do/withGit.d.ts.map +1 -0
- package/dist/do/withGit.js +271 -0
- package/dist/do/withGit.js.map +1 -0
- package/dist/durable-object/object-store.d.ts +157 -15
- package/dist/durable-object/object-store.d.ts.map +1 -1
- package/dist/durable-object/object-store.js +435 -47
- package/dist/durable-object/object-store.js.map +1 -1
- package/dist/durable-object/schema.d.ts +12 -1
- package/dist/durable-object/schema.d.ts.map +1 -1
- package/dist/durable-object/schema.js +87 -2
- package/dist/durable-object/schema.js.map +1 -1
- package/dist/index.d.ts +84 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/sandbox/miniflare-evaluator.d.ts +22 -0
- package/dist/mcp/sandbox/miniflare-evaluator.d.ts.map +1 -0
- package/dist/mcp/sandbox/miniflare-evaluator.js +140 -0
- package/dist/mcp/sandbox/miniflare-evaluator.js.map +1 -0
- package/dist/mcp/sandbox/object-store-proxy.d.ts +32 -0
- package/dist/mcp/sandbox/object-store-proxy.d.ts.map +1 -0
- package/dist/mcp/sandbox/object-store-proxy.js +30 -0
- package/dist/mcp/sandbox/object-store-proxy.js.map +1 -0
- package/dist/mcp/sandbox/template.d.ts +17 -0
- package/dist/mcp/sandbox/template.d.ts.map +1 -0
- package/dist/mcp/sandbox/template.js +71 -0
- package/dist/mcp/sandbox/template.js.map +1 -0
- package/dist/mcp/sandbox.d.ts.map +1 -1
- package/dist/mcp/sandbox.js +16 -4
- package/dist/mcp/sandbox.js.map +1 -1
- package/dist/mcp/tools/do.d.ts +32 -0
- package/dist/mcp/tools/do.d.ts.map +1 -0
- package/dist/mcp/tools/do.js +117 -0
- package/dist/mcp/tools/do.js.map +1 -0
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +1258 -22
- package/dist/mcp/tools.js.map +1 -1
- package/dist/pack/delta.d.ts +8 -0
- package/dist/pack/delta.d.ts.map +1 -1
- package/dist/pack/delta.js +241 -30
- package/dist/pack/delta.js.map +1 -1
- package/dist/refs/branch.d.ts +38 -25
- package/dist/refs/branch.d.ts.map +1 -1
- package/dist/refs/branch.js +421 -94
- package/dist/refs/branch.js.map +1 -1
- package/dist/refs/storage.d.ts +77 -5
- package/dist/refs/storage.d.ts.map +1 -1
- package/dist/refs/storage.js +193 -43
- package/dist/refs/storage.js.map +1 -1
- package/dist/refs/tag.d.ts +44 -24
- package/dist/refs/tag.d.ts.map +1 -1
- package/dist/refs/tag.js +411 -70
- package/dist/refs/tag.js.map +1 -1
- package/dist/storage/backend.d.ts +425 -0
- package/dist/storage/backend.d.ts.map +1 -0
- package/dist/storage/backend.js +41 -0
- package/dist/storage/backend.js.map +1 -0
- package/dist/storage/fsx-adapter.d.ts +204 -0
- package/dist/storage/fsx-adapter.d.ts.map +1 -0
- package/dist/storage/fsx-adapter.js +518 -0
- package/dist/storage/fsx-adapter.js.map +1 -0
- package/dist/storage/r2-pack.d.ts.map +1 -1
- package/dist/storage/r2-pack.js +4 -1
- package/dist/storage/r2-pack.js.map +1 -1
- package/dist/tiered/cdc-pipeline.js +3 -3
- package/dist/tiered/cdc-pipeline.js.map +1 -1
- package/dist/tiered/migration.d.ts.map +1 -1
- package/dist/tiered/migration.js +4 -1
- package/dist/tiered/migration.js.map +1 -1
- package/dist/types/capability.d.ts +1385 -0
- package/dist/types/capability.d.ts.map +1 -0
- package/dist/types/capability.js +36 -0
- package/dist/types/capability.js.map +1 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +18 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/interfaces.d.ts +673 -0
- package/dist/types/interfaces.d.ts.map +1 -0
- package/dist/types/interfaces.js +26 -0
- package/dist/types/interfaces.js.map +1 -0
- package/dist/types/objects.d.ts +182 -0
- package/dist/types/objects.d.ts.map +1 -1
- package/dist/types/objects.js +249 -4
- package/dist/types/objects.js.map +1 -1
- package/dist/types/storage.d.ts +114 -0
- package/dist/types/storage.d.ts.map +1 -1
- package/dist/types/storage.js +160 -1
- package/dist/types/storage.js.map +1 -1
- package/dist/types/worker-loader.d.ts +60 -0
- package/dist/types/worker-loader.d.ts.map +1 -0
- package/dist/types/worker-loader.js +62 -0
- package/dist/types/worker-loader.js.map +1 -0
- package/dist/utils/hash.d.ts +126 -80
- package/dist/utils/hash.d.ts.map +1 -1
- package/dist/utils/hash.js +191 -100
- package/dist/utils/hash.js.map +1 -1
- package/dist/utils/sha1.d.ts +206 -0
- package/dist/utils/sha1.d.ts.map +1 -1
- package/dist/utils/sha1.js +405 -0
- package/dist/utils/sha1.js.map +1 -1
- package/dist/wire/path-security.d.ts +157 -0
- package/dist/wire/path-security.d.ts.map +1 -0
- package/dist/wire/path-security.js +307 -0
- package/dist/wire/path-security.js.map +1 -0
- package/dist/wire/receive-pack.d.ts +7 -0
- package/dist/wire/receive-pack.d.ts.map +1 -1
- package/dist/wire/receive-pack.js +29 -1
- package/dist/wire/receive-pack.js.map +1 -1
- package/dist/wire/upload-pack.d.ts.map +1 -1
- package/dist/wire/upload-pack.js +4 -1
- package/dist/wire/upload-pack.js.map +1 -1
- package/package.json +10 -1
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
* - Content-addressable storage using SHA-1 hashes
|
|
10
10
|
* - Write-ahead logging (WAL) for durability
|
|
11
11
|
* - Object index for tiered storage support
|
|
12
|
-
* - Batch operations for efficiency
|
|
12
|
+
* - Batch operations for efficiency with transaction support
|
|
13
|
+
* - LRU caching for hot tier objects
|
|
14
|
+
* - Metrics and logging infrastructure
|
|
13
15
|
* - Typed accessors for each Git object type
|
|
14
16
|
*
|
|
15
17
|
* @module durable-object/object-store
|
|
@@ -18,22 +20,32 @@
|
|
|
18
20
|
* ```typescript
|
|
19
21
|
* import { ObjectStore } from './durable-object/object-store'
|
|
20
22
|
*
|
|
21
|
-
* const store = new ObjectStore(durableObjectStorage
|
|
23
|
+
* const store = new ObjectStore(durableObjectStorage, {
|
|
24
|
+
* cacheMaxCount: 1000,
|
|
25
|
+
* cacheMaxBytes: 50 * 1024 * 1024, // 50MB
|
|
26
|
+
* enableMetrics: true
|
|
27
|
+
* })
|
|
22
28
|
*
|
|
23
29
|
* // Store a blob
|
|
24
30
|
* const content = new TextEncoder().encode('Hello, World!')
|
|
25
31
|
* const sha = await store.putObject('blob', content)
|
|
26
32
|
*
|
|
27
|
-
* // Retrieve it
|
|
33
|
+
* // Retrieve it (cached on second access)
|
|
28
34
|
* const obj = await store.getObject(sha)
|
|
29
35
|
* console.log(obj?.type, obj?.size)
|
|
30
36
|
*
|
|
31
37
|
* // Get typed object
|
|
32
38
|
* const blob = await store.getBlobObject(sha)
|
|
39
|
+
*
|
|
40
|
+
* // Get metrics
|
|
41
|
+
* const metrics = store.getMetrics()
|
|
42
|
+
* console.log(`Cache hit rate: ${metrics.cacheHitRate}%`)
|
|
33
43
|
* ```
|
|
34
44
|
*/
|
|
35
45
|
import { DurableObjectStorage } from './schema';
|
|
46
|
+
import { CacheStats } from '../storage/lru-cache';
|
|
36
47
|
import { ObjectType, BlobObject, TreeObject, CommitObject, TagObject, TreeEntry, Author } from '../types/objects';
|
|
48
|
+
import type { StorageBackend } from '../storage/backend';
|
|
37
49
|
/**
|
|
38
50
|
* Stored object record as persisted in SQLite.
|
|
39
51
|
*
|
|
@@ -64,6 +76,93 @@ export interface StoredObject {
|
|
|
64
76
|
/** Unix timestamp (milliseconds) when object was created */
|
|
65
77
|
createdAt: number;
|
|
66
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Configuration options for ObjectStore.
|
|
81
|
+
*
|
|
82
|
+
* @description
|
|
83
|
+
* Controls caching behavior, metrics collection, and logging.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* const options: ObjectStoreOptions = {
|
|
88
|
+
* cacheMaxCount: 1000,
|
|
89
|
+
* cacheMaxBytes: 50 * 1024 * 1024,
|
|
90
|
+
* cacheTTL: 3600000,
|
|
91
|
+
* enableMetrics: true,
|
|
92
|
+
* logger: console
|
|
93
|
+
* }
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export interface ObjectStoreOptions {
|
|
97
|
+
/**
|
|
98
|
+
* Maximum number of objects to cache in memory.
|
|
99
|
+
* @default 500
|
|
100
|
+
*/
|
|
101
|
+
cacheMaxCount?: number;
|
|
102
|
+
/**
|
|
103
|
+
* Maximum cache size in bytes.
|
|
104
|
+
* @default 25MB
|
|
105
|
+
*/
|
|
106
|
+
cacheMaxBytes?: number;
|
|
107
|
+
/**
|
|
108
|
+
* Time-to-live for cached objects in milliseconds.
|
|
109
|
+
* @default undefined (no expiration)
|
|
110
|
+
*/
|
|
111
|
+
cacheTTL?: number;
|
|
112
|
+
/**
|
|
113
|
+
* Enable metrics collection.
|
|
114
|
+
* @default false
|
|
115
|
+
*/
|
|
116
|
+
enableMetrics?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Logger interface for operation logging.
|
|
119
|
+
* @default undefined (no logging)
|
|
120
|
+
*/
|
|
121
|
+
logger?: ObjectStoreLogger;
|
|
122
|
+
/**
|
|
123
|
+
* Optional storage backend abstraction.
|
|
124
|
+
* If provided, delegates CAS operations to this backend instead of SQLite.
|
|
125
|
+
* This enables gradual migration to different storage implementations.
|
|
126
|
+
* @default undefined (uses SQLite directly)
|
|
127
|
+
*/
|
|
128
|
+
backend?: StorageBackend;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Logger interface for ObjectStore operations.
|
|
132
|
+
*/
|
|
133
|
+
export interface ObjectStoreLogger {
|
|
134
|
+
debug?(message: string, ...args: unknown[]): void;
|
|
135
|
+
info?(message: string, ...args: unknown[]): void;
|
|
136
|
+
warn?(message: string, ...args: unknown[]): void;
|
|
137
|
+
error?(message: string, ...args: unknown[]): void;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Metrics collected by ObjectStore operations.
|
|
141
|
+
*/
|
|
142
|
+
export interface ObjectStoreMetrics {
|
|
143
|
+
/** Total number of read operations */
|
|
144
|
+
reads: number;
|
|
145
|
+
/** Total number of write operations */
|
|
146
|
+
writes: number;
|
|
147
|
+
/** Total number of delete operations */
|
|
148
|
+
deletes: number;
|
|
149
|
+
/** Cache statistics */
|
|
150
|
+
cache: CacheStats;
|
|
151
|
+
/** Cache hit rate percentage */
|
|
152
|
+
cacheHitRate: number;
|
|
153
|
+
/** Total bytes written */
|
|
154
|
+
bytesWritten: number;
|
|
155
|
+
/** Total bytes read */
|
|
156
|
+
bytesRead: number;
|
|
157
|
+
/** Average write latency in ms */
|
|
158
|
+
avgWriteLatencyMs: number;
|
|
159
|
+
/** Average read latency in ms */
|
|
160
|
+
avgReadLatencyMs: number;
|
|
161
|
+
/** Number of batch operations */
|
|
162
|
+
batchOperations: number;
|
|
163
|
+
/** Total objects in batch operations */
|
|
164
|
+
batchObjectsTotal: number;
|
|
165
|
+
}
|
|
67
166
|
/**
|
|
68
167
|
* ObjectStore class for managing Git objects in SQLite storage.
|
|
69
168
|
*
|
|
@@ -92,12 +191,50 @@ export interface StoredObject {
|
|
|
92
191
|
*/
|
|
93
192
|
export declare class ObjectStore {
|
|
94
193
|
private storage;
|
|
194
|
+
private cache;
|
|
195
|
+
private options;
|
|
196
|
+
private logger?;
|
|
197
|
+
private backend;
|
|
198
|
+
private _reads;
|
|
199
|
+
private _writes;
|
|
200
|
+
private _deletes;
|
|
201
|
+
private _bytesWritten;
|
|
202
|
+
private _bytesRead;
|
|
203
|
+
private _totalWriteLatency;
|
|
204
|
+
private _totalReadLatency;
|
|
205
|
+
private _batchOperations;
|
|
206
|
+
private _batchObjectsTotal;
|
|
95
207
|
/**
|
|
96
208
|
* Create a new ObjectStore.
|
|
97
209
|
*
|
|
98
210
|
* @param storage - Durable Object storage interface with SQL support
|
|
211
|
+
* @param options - Configuration options for caching, metrics, logging, and backend
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* ```typescript
|
|
215
|
+
* // Basic usage (SQLite backend)
|
|
216
|
+
* const store = new ObjectStore(storage)
|
|
217
|
+
*
|
|
218
|
+
* // With caching and metrics
|
|
219
|
+
* const store = new ObjectStore(storage, {
|
|
220
|
+
* cacheMaxCount: 1000,
|
|
221
|
+
* cacheMaxBytes: 50 * 1024 * 1024,
|
|
222
|
+
* enableMetrics: true,
|
|
223
|
+
* logger: console
|
|
224
|
+
* })
|
|
225
|
+
*
|
|
226
|
+
* // With StorageBackend abstraction
|
|
227
|
+
* const store = new ObjectStore(storage, {
|
|
228
|
+
* backend: fsBackend
|
|
229
|
+
* })
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
constructor(storage: DurableObjectStorage, options?: ObjectStoreOptions);
|
|
233
|
+
/**
|
|
234
|
+
* Log a message if logger is configured.
|
|
235
|
+
* @internal
|
|
99
236
|
*/
|
|
100
|
-
|
|
237
|
+
private log;
|
|
101
238
|
/**
|
|
102
239
|
* Store a raw object and return its SHA.
|
|
103
240
|
*
|
|
@@ -105,6 +242,7 @@ export declare class ObjectStore {
|
|
|
105
242
|
* Computes the SHA-1 hash of the object in Git format (type + size + content),
|
|
106
243
|
* logs the operation to WAL, stores the object, and updates the object index.
|
|
107
244
|
* If an object with the same SHA already exists, it is replaced (idempotent).
|
|
245
|
+
* The object is also added to the LRU cache for fast subsequent reads.
|
|
108
246
|
*
|
|
109
247
|
* @param type - Object type ('blob', 'tree', 'commit', 'tag')
|
|
110
248
|
* @param data - Raw object content (without Git header)
|
|
@@ -208,7 +346,7 @@ export declare class ObjectStore {
|
|
|
208
346
|
putTagObject(tag: {
|
|
209
347
|
object: string;
|
|
210
348
|
objectType: ObjectType;
|
|
211
|
-
tagger
|
|
349
|
+
tagger?: Author;
|
|
212
350
|
message: string;
|
|
213
351
|
name: string;
|
|
214
352
|
}): Promise<string>;
|
|
@@ -216,8 +354,8 @@ export declare class ObjectStore {
|
|
|
216
354
|
* Retrieve an object by SHA.
|
|
217
355
|
*
|
|
218
356
|
* @description
|
|
219
|
-
* Fetches an object from the
|
|
220
|
-
* Returns null if the object doesn't exist or if the SHA is invalid.
|
|
357
|
+
* Fetches an object from the LRU cache first, falling back to the database
|
|
358
|
+
* if not cached. Returns null if the object doesn't exist or if the SHA is invalid.
|
|
221
359
|
*
|
|
222
360
|
* @param sha - 40-character SHA-1 hash
|
|
223
361
|
* @returns The stored object or null if not found
|
|
@@ -235,7 +373,7 @@ export declare class ObjectStore {
|
|
|
235
373
|
* Delete an object by SHA.
|
|
236
374
|
*
|
|
237
375
|
* @description
|
|
238
|
-
* Removes an object from
|
|
376
|
+
* Removes an object from the cache, objects table, and the object index.
|
|
239
377
|
* The operation is logged to WAL. Returns false if the object doesn't exist.
|
|
240
378
|
*
|
|
241
379
|
* **Warning**: Deleting objects that are still referenced by other objects
|
|
@@ -326,12 +464,14 @@ export declare class ObjectStore {
|
|
|
326
464
|
*/
|
|
327
465
|
getObjectSize(sha: string): Promise<number | null>;
|
|
328
466
|
/**
|
|
329
|
-
* Store multiple objects in a batch.
|
|
467
|
+
* Store multiple objects in a batch using a single transaction.
|
|
330
468
|
*
|
|
331
469
|
* @description
|
|
332
|
-
* Stores multiple objects
|
|
333
|
-
*
|
|
334
|
-
*
|
|
470
|
+
* Stores multiple objects atomically within a single SQLite transaction.
|
|
471
|
+
* This is more efficient than individual puts for bulk operations as it:
|
|
472
|
+
* - Reduces the number of disk flushes
|
|
473
|
+
* - Ensures atomic writes (all-or-nothing)
|
|
474
|
+
* - Batches WAL entries for better performance
|
|
335
475
|
*
|
|
336
476
|
* @param objects - Array of objects to store
|
|
337
477
|
* @returns Array of SHA-1 hashes in the same order as input
|
|
@@ -349,11 +489,13 @@ export declare class ObjectStore {
|
|
|
349
489
|
data: Uint8Array;
|
|
350
490
|
}[]): Promise<string[]>;
|
|
351
491
|
/**
|
|
352
|
-
* Retrieve multiple objects by SHA.
|
|
492
|
+
* Retrieve multiple objects by SHA using optimized batch queries.
|
|
353
493
|
*
|
|
354
494
|
* @description
|
|
355
|
-
* Fetches multiple objects by
|
|
356
|
-
*
|
|
495
|
+
* Fetches multiple objects efficiently by:
|
|
496
|
+
* 1. First checking the LRU cache for each SHA
|
|
497
|
+
* 2. Batching uncached SHAs into a single SQL query with IN clause
|
|
498
|
+
* 3. Returning results in the original order with null for missing objects
|
|
357
499
|
*
|
|
358
500
|
* @param shas - Array of 40-character SHA-1 hashes
|
|
359
501
|
* @returns Array of objects (or null for missing) in the same order
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-store.d.ts","sourceRoot":"","sources":["../../src/durable-object/object-store.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"object-store.d.ts","sourceRoot":"","sources":["../../src/durable-object/object-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,EAAY,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EACL,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACZ,SAAS,EACT,SAAS,EACT,MAAM,EAGP,MAAM,kBAAkB,CAAA;AAMzB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAMxD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,YAAY;IAC3B,4CAA4C;IAC5C,GAAG,EAAE,MAAM,CAAA;IACX,sDAAsD;IACtD,IAAI,EAAE,UAAU,CAAA;IAChB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,8CAA8C;IAC9C,IAAI,EAAE,UAAU,CAAA;IAChB,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB;;;OAG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