@elaraai/e3-core 0.0.2-beta.4 → 0.0.2-beta.40

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.
Files changed (208) hide show
  1. package/README.md +25 -22
  2. package/dist/src/dataflow/api-compat.d.ts +90 -0
  3. package/dist/src/dataflow/api-compat.d.ts.map +1 -0
  4. package/dist/src/dataflow/api-compat.js +139 -0
  5. package/dist/src/dataflow/api-compat.js.map +1 -0
  6. package/dist/src/dataflow/index.d.ts +18 -0
  7. package/dist/src/dataflow/index.d.ts.map +1 -0
  8. package/dist/src/dataflow/index.js +23 -0
  9. package/dist/src/dataflow/index.js.map +1 -0
  10. package/dist/src/dataflow/orchestrator/LocalOrchestrator.d.ts +76 -0
  11. package/dist/src/dataflow/orchestrator/LocalOrchestrator.d.ts.map +1 -0
  12. package/dist/src/dataflow/orchestrator/LocalOrchestrator.js +695 -0
  13. package/dist/src/dataflow/orchestrator/LocalOrchestrator.js.map +1 -0
  14. package/dist/src/dataflow/orchestrator/index.d.ts +12 -0
  15. package/dist/src/dataflow/orchestrator/index.d.ts.map +1 -0
  16. package/dist/src/dataflow/orchestrator/index.js +12 -0
  17. package/dist/src/dataflow/orchestrator/index.js.map +1 -0
  18. package/dist/src/dataflow/orchestrator/interfaces.d.ts +163 -0
  19. package/dist/src/dataflow/orchestrator/interfaces.d.ts.map +1 -0
  20. package/dist/src/dataflow/orchestrator/interfaces.js +52 -0
  21. package/dist/src/dataflow/orchestrator/interfaces.js.map +1 -0
  22. package/dist/src/dataflow/state-store/FileStateStore.d.ts +67 -0
  23. package/dist/src/dataflow/state-store/FileStateStore.d.ts.map +1 -0
  24. package/dist/src/dataflow/state-store/FileStateStore.js +300 -0
  25. package/dist/src/dataflow/state-store/FileStateStore.js.map +1 -0
  26. package/dist/src/dataflow/state-store/InMemoryStateStore.d.ts +42 -0
  27. package/dist/src/dataflow/state-store/InMemoryStateStore.d.ts.map +1 -0
  28. package/dist/src/dataflow/state-store/InMemoryStateStore.js +229 -0
  29. package/dist/src/dataflow/state-store/InMemoryStateStore.js.map +1 -0
  30. package/dist/src/dataflow/state-store/index.d.ts +13 -0
  31. package/dist/src/dataflow/state-store/index.d.ts.map +1 -0
  32. package/dist/src/dataflow/state-store/index.js +13 -0
  33. package/dist/src/dataflow/state-store/index.js.map +1 -0
  34. package/dist/src/dataflow/state-store/interfaces.d.ts +159 -0
  35. package/dist/src/dataflow/state-store/interfaces.d.ts.map +1 -0
  36. package/dist/src/dataflow/state-store/interfaces.js +6 -0
  37. package/dist/src/dataflow/state-store/interfaces.js.map +1 -0
  38. package/dist/src/dataflow/steps.d.ts +222 -0
  39. package/dist/src/dataflow/steps.d.ts.map +1 -0
  40. package/dist/src/dataflow/steps.js +707 -0
  41. package/dist/src/dataflow/steps.js.map +1 -0
  42. package/dist/src/dataflow/types.d.ts +127 -0
  43. package/dist/src/dataflow/types.d.ts.map +1 -0
  44. package/dist/src/dataflow/types.js +7 -0
  45. package/dist/src/dataflow/types.js.map +1 -0
  46. package/dist/src/dataflow.d.ts +113 -38
  47. package/dist/src/dataflow.d.ts.map +1 -1
  48. package/dist/src/dataflow.js +269 -416
  49. package/dist/src/dataflow.js.map +1 -1
  50. package/dist/src/dataset-refs.d.ts +124 -0
  51. package/dist/src/dataset-refs.d.ts.map +1 -0
  52. package/dist/src/dataset-refs.js +319 -0
  53. package/dist/src/dataset-refs.js.map +1 -0
  54. package/dist/src/errors.d.ts +39 -9
  55. package/dist/src/errors.d.ts.map +1 -1
  56. package/dist/src/errors.js +51 -8
  57. package/dist/src/errors.js.map +1 -1
  58. package/dist/src/execution/LocalTaskRunner.d.ts +73 -0
  59. package/dist/src/execution/LocalTaskRunner.d.ts.map +1 -0
  60. package/dist/src/execution/LocalTaskRunner.js +399 -0
  61. package/dist/src/execution/LocalTaskRunner.js.map +1 -0
  62. package/dist/src/execution/MockTaskRunner.d.ts +49 -0
  63. package/dist/src/execution/MockTaskRunner.d.ts.map +1 -0
  64. package/dist/src/execution/MockTaskRunner.js +54 -0
  65. package/dist/src/execution/MockTaskRunner.js.map +1 -0
  66. package/dist/src/execution/index.d.ts +16 -0
  67. package/dist/src/execution/index.d.ts.map +1 -0
  68. package/dist/src/execution/index.js +8 -0
  69. package/dist/src/execution/index.js.map +1 -0
  70. package/dist/src/execution/interfaces.d.ts +246 -0
  71. package/dist/src/execution/interfaces.d.ts.map +1 -0
  72. package/dist/src/execution/interfaces.js +6 -0
  73. package/dist/src/execution/interfaces.js.map +1 -0
  74. package/dist/src/execution/processHelpers.d.ts +20 -0
  75. package/dist/src/execution/processHelpers.d.ts.map +1 -0
  76. package/dist/src/execution/processHelpers.js +62 -0
  77. package/dist/src/execution/processHelpers.js.map +1 -0
  78. package/dist/src/executions.d.ts +71 -104
  79. package/dist/src/executions.d.ts.map +1 -1
  80. package/dist/src/executions.js +110 -476
  81. package/dist/src/executions.js.map +1 -1
  82. package/dist/src/index.d.ts +19 -9
  83. package/dist/src/index.d.ts.map +1 -1
  84. package/dist/src/index.js +48 -18
  85. package/dist/src/index.js.map +1 -1
  86. package/dist/src/objects.d.ts +8 -51
  87. package/dist/src/objects.d.ts.map +1 -1
  88. package/dist/src/objects.js +13 -230
  89. package/dist/src/objects.js.map +1 -1
  90. package/dist/src/packages.d.ts +22 -14
  91. package/dist/src/packages.d.ts.map +1 -1
  92. package/dist/src/packages.js +134 -88
  93. package/dist/src/packages.js.map +1 -1
  94. package/dist/src/storage/in-memory/InMemoryRepoStore.d.ts +35 -0
  95. package/dist/src/storage/in-memory/InMemoryRepoStore.d.ts.map +1 -0
  96. package/dist/src/storage/in-memory/InMemoryRepoStore.js +107 -0
  97. package/dist/src/storage/in-memory/InMemoryRepoStore.js.map +1 -0
  98. package/dist/src/storage/in-memory/InMemoryStorage.d.ts +139 -0
  99. package/dist/src/storage/in-memory/InMemoryStorage.d.ts.map +1 -0
  100. package/dist/src/storage/in-memory/InMemoryStorage.js +439 -0
  101. package/dist/src/storage/in-memory/InMemoryStorage.js.map +1 -0
  102. package/dist/src/storage/in-memory/index.d.ts +12 -0
  103. package/dist/src/storage/in-memory/index.d.ts.map +1 -0
  104. package/dist/src/storage/in-memory/index.js +12 -0
  105. package/dist/src/storage/in-memory/index.js.map +1 -0
  106. package/dist/src/storage/index.d.ts +18 -0
  107. package/dist/src/storage/index.d.ts.map +1 -0
  108. package/dist/src/storage/index.js +10 -0
  109. package/dist/src/storage/index.js.map +1 -0
  110. package/dist/src/storage/interfaces.d.ts +581 -0
  111. package/dist/src/storage/interfaces.d.ts.map +1 -0
  112. package/dist/src/storage/interfaces.js +6 -0
  113. package/dist/src/storage/interfaces.js.map +1 -0
  114. package/dist/src/storage/local/LocalBackend.d.ts +56 -0
  115. package/dist/src/storage/local/LocalBackend.d.ts.map +1 -0
  116. package/dist/src/storage/local/LocalBackend.js +145 -0
  117. package/dist/src/storage/local/LocalBackend.js.map +1 -0
  118. package/dist/src/storage/local/LocalDatasetRefStore.d.ts +22 -0
  119. package/dist/src/storage/local/LocalDatasetRefStore.d.ts.map +1 -0
  120. package/dist/src/storage/local/LocalDatasetRefStore.js +118 -0
  121. package/dist/src/storage/local/LocalDatasetRefStore.js.map +1 -0
  122. package/dist/src/storage/local/LocalLockService.d.ts +111 -0
  123. package/dist/src/storage/local/LocalLockService.d.ts.map +1 -0
  124. package/dist/src/storage/local/LocalLockService.js +355 -0
  125. package/dist/src/storage/local/LocalLockService.js.map +1 -0
  126. package/dist/src/storage/local/LocalLogStore.d.ts +23 -0
  127. package/dist/src/storage/local/LocalLogStore.d.ts.map +1 -0
  128. package/dist/src/storage/local/LocalLogStore.js +66 -0
  129. package/dist/src/storage/local/LocalLogStore.js.map +1 -0
  130. package/dist/src/storage/local/LocalObjectStore.d.ts +55 -0
  131. package/dist/src/storage/local/LocalObjectStore.d.ts.map +1 -0
  132. package/dist/src/storage/local/LocalObjectStore.js +300 -0
  133. package/dist/src/storage/local/LocalObjectStore.js.map +1 -0
  134. package/dist/src/storage/local/LocalRefStore.d.ts +50 -0
  135. package/dist/src/storage/local/LocalRefStore.d.ts.map +1 -0
  136. package/dist/src/storage/local/LocalRefStore.js +337 -0
  137. package/dist/src/storage/local/LocalRefStore.js.map +1 -0
  138. package/dist/src/storage/local/LocalRepoStore.d.ts +55 -0
  139. package/dist/src/storage/local/LocalRepoStore.d.ts.map +1 -0
  140. package/dist/src/storage/local/LocalRepoStore.js +365 -0
  141. package/dist/src/storage/local/LocalRepoStore.js.map +1 -0
  142. package/dist/src/storage/local/gc.d.ts +92 -0
  143. package/dist/src/storage/local/gc.d.ts.map +1 -0
  144. package/dist/src/storage/local/gc.js +377 -0
  145. package/dist/src/storage/local/gc.js.map +1 -0
  146. package/dist/src/storage/local/index.d.ts +18 -0
  147. package/dist/src/storage/local/index.d.ts.map +1 -0
  148. package/dist/src/storage/local/index.js +18 -0
  149. package/dist/src/storage/local/index.js.map +1 -0
  150. package/dist/src/storage/local/localHelpers.d.ts +25 -0
  151. package/dist/src/storage/local/localHelpers.d.ts.map +1 -0
  152. package/dist/src/storage/local/localHelpers.js +69 -0
  153. package/dist/src/storage/local/localHelpers.js.map +1 -0
  154. package/dist/src/{repository.d.ts → storage/local/repository.d.ts} +8 -4
  155. package/dist/src/storage/local/repository.d.ts.map +1 -0
  156. package/dist/src/{repository.js → storage/local/repository.js} +31 -29
  157. package/dist/src/storage/local/repository.js.map +1 -0
  158. package/dist/src/tasks.d.ts +16 -10
  159. package/dist/src/tasks.d.ts.map +1 -1
  160. package/dist/src/tasks.js +35 -41
  161. package/dist/src/tasks.js.map +1 -1
  162. package/dist/src/test-helpers.d.ts +5 -4
  163. package/dist/src/test-helpers.d.ts.map +1 -1
  164. package/dist/src/test-helpers.js +9 -21
  165. package/dist/src/test-helpers.js.map +1 -1
  166. package/dist/src/transfer/InMemoryTransferBackend.d.ts +66 -0
  167. package/dist/src/transfer/InMemoryTransferBackend.d.ts.map +1 -0
  168. package/dist/src/transfer/InMemoryTransferBackend.js +166 -0
  169. package/dist/src/transfer/InMemoryTransferBackend.js.map +1 -0
  170. package/dist/src/transfer/index.d.ts +8 -0
  171. package/dist/src/transfer/index.d.ts.map +1 -0
  172. package/dist/src/transfer/index.js +9 -0
  173. package/dist/src/transfer/index.js.map +1 -0
  174. package/dist/src/transfer/interfaces.d.ts +103 -0
  175. package/dist/src/transfer/interfaces.d.ts.map +1 -0
  176. package/dist/src/transfer/interfaces.js +6 -0
  177. package/dist/src/transfer/interfaces.js.map +1 -0
  178. package/dist/src/transfer/types.d.ts +79 -0
  179. package/dist/src/transfer/types.d.ts.map +1 -0
  180. package/dist/src/transfer/types.js +58 -0
  181. package/dist/src/transfer/types.js.map +1 -0
  182. package/dist/src/trees.d.ts +147 -59
  183. package/dist/src/trees.d.ts.map +1 -1
  184. package/dist/src/trees.js +372 -419
  185. package/dist/src/trees.js.map +1 -1
  186. package/dist/src/uuid.d.ts +26 -0
  187. package/dist/src/uuid.d.ts.map +1 -0
  188. package/dist/src/uuid.js +80 -0
  189. package/dist/src/uuid.js.map +1 -0
  190. package/dist/src/workspaceStatus.d.ts +6 -4
  191. package/dist/src/workspaceStatus.d.ts.map +1 -1
  192. package/dist/src/workspaceStatus.js +43 -49
  193. package/dist/src/workspaceStatus.js.map +1 -1
  194. package/dist/src/workspaces.d.ts +35 -47
  195. package/dist/src/workspaces.d.ts.map +1 -1
  196. package/dist/src/workspaces.js +194 -156
  197. package/dist/src/workspaces.js.map +1 -1
  198. package/package.json +4 -4
  199. package/dist/src/gc.d.ts +0 -54
  200. package/dist/src/gc.d.ts.map +0 -1
  201. package/dist/src/gc.js +0 -233
  202. package/dist/src/gc.js.map +0 -1
  203. package/dist/src/repository.d.ts.map +0 -1
  204. package/dist/src/repository.js.map +0 -1
  205. package/dist/src/workspaceLock.d.ts +0 -67
  206. package/dist/src/workspaceLock.d.ts.map +0 -1
  207. package/dist/src/workspaceLock.js +0 -217
  208. package/dist/src/workspaceLock.js.map +0 -1
@@ -0,0 +1,439 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ import { none } from '@elaraai/east';
6
+ import { computeHash } from '../../objects.js';
7
+ import { ObjectNotFoundError, RepoNotFoundError } from '../../errors.js';
8
+ import { InMemoryRepoStore } from './InMemoryRepoStore.js';
9
+ /**
10
+ * In-memory implementation of ObjectStore for testing.
11
+ */
12
+ /* eslint-disable @typescript-eslint/require-await */
13
+ class InMemoryObjectStore {
14
+ objects = new Map();
15
+ getRepoObjects(repo) {
16
+ let repoObjects = this.objects.get(repo);
17
+ if (!repoObjects) {
18
+ repoObjects = new Map();
19
+ this.objects.set(repo, repoObjects);
20
+ }
21
+ return repoObjects;
22
+ }
23
+ async write(repo, data) {
24
+ const hash = computeHash(data);
25
+ this.getRepoObjects(repo).set(hash, data);
26
+ return hash;
27
+ }
28
+ async writeStream(repo, stream) {
29
+ const chunks = [];
30
+ for await (const chunk of stream) {
31
+ chunks.push(chunk);
32
+ }
33
+ const totalLength = chunks.reduce((sum, chunk) => sum + chunk.length, 0);
34
+ const data = new Uint8Array(totalLength);
35
+ let offset = 0;
36
+ for (const chunk of chunks) {
37
+ data.set(chunk, offset);
38
+ offset += chunk.length;
39
+ }
40
+ return this.write(repo, data);
41
+ }
42
+ async read(repo, hash) {
43
+ const data = this.getRepoObjects(repo).get(hash);
44
+ if (!data) {
45
+ throw new ObjectNotFoundError(hash);
46
+ }
47
+ return data;
48
+ }
49
+ async exists(repo, hash) {
50
+ return this.getRepoObjects(repo).has(hash);
51
+ }
52
+ async stat(repo, hash) {
53
+ const data = this.getRepoObjects(repo).get(hash);
54
+ if (!data) {
55
+ throw new ObjectNotFoundError(hash);
56
+ }
57
+ return { size: data.length };
58
+ }
59
+ async list(repo) {
60
+ return [...this.getRepoObjects(repo).keys()];
61
+ }
62
+ async count(repo) {
63
+ return this.getRepoObjects(repo).size;
64
+ }
65
+ clear() {
66
+ this.objects.clear();
67
+ }
68
+ }
69
+ /**
70
+ * In-memory implementation of RefStore for testing.
71
+ */
72
+ /* eslint-disable @typescript-eslint/require-await */
73
+ class InMemoryRefStore {
74
+ packages = new Map();
75
+ workspaces = new Map();
76
+ // executions now keyed by taskHash/inputsHash/executionId
77
+ executions = new Map();
78
+ // dataflow runs keyed by workspace/runId
79
+ dataflowRuns = new Map();
80
+ getPackages(repo) {
81
+ let repoPackages = this.packages.get(repo);
82
+ if (!repoPackages) {
83
+ repoPackages = new Map();
84
+ this.packages.set(repo, repoPackages);
85
+ }
86
+ return repoPackages;
87
+ }
88
+ getWorkspaces(repo) {
89
+ let repoWorkspaces = this.workspaces.get(repo);
90
+ if (!repoWorkspaces) {
91
+ repoWorkspaces = new Map();
92
+ this.workspaces.set(repo, repoWorkspaces);
93
+ }
94
+ return repoWorkspaces;
95
+ }
96
+ getExecutions(repo) {
97
+ let repoExecutions = this.executions.get(repo);
98
+ if (!repoExecutions) {
99
+ repoExecutions = new Map();
100
+ this.executions.set(repo, repoExecutions);
101
+ }
102
+ return repoExecutions;
103
+ }
104
+ getDataflowRuns(repo) {
105
+ let repoRuns = this.dataflowRuns.get(repo);
106
+ if (!repoRuns) {
107
+ repoRuns = new Map();
108
+ this.dataflowRuns.set(repo, repoRuns);
109
+ }
110
+ return repoRuns;
111
+ }
112
+ makePackageKey(name, version) {
113
+ return `${name}@${version}`;
114
+ }
115
+ makeExecutionKey(taskHash, inputsHash, executionId) {
116
+ return `${taskHash}/${inputsHash}/${executionId}`;
117
+ }
118
+ makeInputsKey(taskHash, inputsHash) {
119
+ return `${taskHash}/${inputsHash}`;
120
+ }
121
+ makeDataflowRunKey(workspace, runId) {
122
+ return `${workspace}/${runId}`;
123
+ }
124
+ // Package operations
125
+ async packageList(repo) {
126
+ const result = [];
127
+ for (const key of this.getPackages(repo).keys()) {
128
+ const [name, version] = key.split('@');
129
+ result.push({ name: name, version: version });
130
+ }
131
+ return result;
132
+ }
133
+ async packageResolve(repo, name, version) {
134
+ return this.getPackages(repo).get(this.makePackageKey(name, version)) ?? null;
135
+ }
136
+ async packageWrite(repo, name, version, hash) {
137
+ this.getPackages(repo).set(this.makePackageKey(name, version), hash);
138
+ }
139
+ async packageRemove(repo, name, version) {
140
+ this.getPackages(repo).delete(this.makePackageKey(name, version));
141
+ }
142
+ // Workspace operations
143
+ async workspaceList(repo) {
144
+ return [...this.getWorkspaces(repo).keys()];
145
+ }
146
+ async workspaceRead(repo, name) {
147
+ return this.getWorkspaces(repo).get(name) ?? null;
148
+ }
149
+ async workspaceWrite(repo, name, state) {
150
+ this.getWorkspaces(repo).set(name, state);
151
+ }
152
+ async workspaceRemove(repo, name) {
153
+ this.getWorkspaces(repo).delete(name);
154
+ }
155
+ // Execution operations (with executionId)
156
+ async executionGet(repo, taskHash, inputsHash, executionId) {
157
+ return this.getExecutions(repo).get(this.makeExecutionKey(taskHash, inputsHash, executionId)) ?? null;
158
+ }
159
+ async executionWrite(repo, taskHash, inputsHash, executionId, status) {
160
+ this.getExecutions(repo).set(this.makeExecutionKey(taskHash, inputsHash, executionId), status);
161
+ }
162
+ async executionListIds(repo, taskHash, inputsHash) {
163
+ const prefix = this.makeInputsKey(taskHash, inputsHash) + '/';
164
+ const ids = [];
165
+ for (const key of this.getExecutions(repo).keys()) {
166
+ if (key.startsWith(prefix)) {
167
+ ids.push(key.slice(prefix.length));
168
+ }
169
+ }
170
+ return ids.sort();
171
+ }
172
+ async executionGetLatest(repo, taskHash, inputsHash) {
173
+ const ids = await this.executionListIds(repo, taskHash, inputsHash);
174
+ if (ids.length === 0)
175
+ return null;
176
+ const latestId = ids[ids.length - 1];
177
+ return this.executionGet(repo, taskHash, inputsHash, latestId);
178
+ }
179
+ async executionGetLatestOutput(repo, taskHash, inputsHash) {
180
+ const ids = await this.executionListIds(repo, taskHash, inputsHash);
181
+ // Iterate from latest to oldest
182
+ for (let i = ids.length - 1; i >= 0; i--) {
183
+ const status = await this.executionGet(repo, taskHash, inputsHash, ids[i]);
184
+ if (status && status.type === 'success') {
185
+ return status.value.outputHash;
186
+ }
187
+ }
188
+ return null;
189
+ }
190
+ async executionList(repo) {
191
+ const seen = new Set();
192
+ const result = [];
193
+ for (const key of this.getExecutions(repo).keys()) {
194
+ const parts = key.split('/');
195
+ const inputsKey = `${parts[0]}/${parts[1]}`;
196
+ if (!seen.has(inputsKey)) {
197
+ seen.add(inputsKey);
198
+ result.push({ taskHash: parts[0], inputsHash: parts[1] });
199
+ }
200
+ }
201
+ return result;
202
+ }
203
+ async executionListForTask(repo, taskHash) {
204
+ const seen = new Set();
205
+ for (const key of this.getExecutions(repo).keys()) {
206
+ if (key.startsWith(`${taskHash}/`)) {
207
+ const parts = key.split('/');
208
+ seen.add(parts[1]);
209
+ }
210
+ }
211
+ return [...seen];
212
+ }
213
+ // Dataflow run operations
214
+ async dataflowRunGet(repo, workspace, runId) {
215
+ return this.getDataflowRuns(repo).get(this.makeDataflowRunKey(workspace, runId)) ?? null;
216
+ }
217
+ async dataflowRunWrite(repo, workspace, run) {
218
+ this.getDataflowRuns(repo).set(this.makeDataflowRunKey(workspace, run.runId), run);
219
+ }
220
+ async dataflowRunList(repo, workspace) {
221
+ const prefix = `${workspace}/`;
222
+ const ids = [];
223
+ for (const key of this.getDataflowRuns(repo).keys()) {
224
+ if (key.startsWith(prefix)) {
225
+ ids.push(key.slice(prefix.length));
226
+ }
227
+ }
228
+ return ids.sort();
229
+ }
230
+ async dataflowRunGetLatest(repo, workspace) {
231
+ const ids = await this.dataflowRunList(repo, workspace);
232
+ if (ids.length === 0)
233
+ return null;
234
+ const latestId = ids[ids.length - 1];
235
+ return this.dataflowRunGet(repo, workspace, latestId);
236
+ }
237
+ async dataflowRunDelete(repo, workspace, runId) {
238
+ const key = this.makeDataflowRunKey(workspace, runId);
239
+ this.getDataflowRuns(repo).delete(key);
240
+ }
241
+ clear() {
242
+ this.packages.clear();
243
+ this.workspaces.clear();
244
+ this.executions.clear();
245
+ this.dataflowRuns.clear();
246
+ }
247
+ }
248
+ /**
249
+ * In-memory implementation of LockService for testing.
250
+ *
251
+ * Supports shared/exclusive lock modes:
252
+ * - Multiple shared holders can coexist on the same resource
253
+ * - Exclusive locks require zero holders
254
+ * - Shared locks fail if an exclusive holder exists
255
+ */
256
+ /* eslint-disable @typescript-eslint/require-await */
257
+ class InMemoryLockService {
258
+ // Track exclusive locks (at most one per resource)
259
+ exclusiveLocks = new Map();
260
+ // Track shared lock count per resource
261
+ sharedLockCounts = new Map();
262
+ makeLockKey(repo, resource) {
263
+ return `${repo}:${resource}`;
264
+ }
265
+ async acquire(repo, resource, operation, options) {
266
+ const key = this.makeLockKey(repo, resource);
267
+ const mode = options?.mode ?? 'exclusive';
268
+ if (mode === 'shared') {
269
+ // Shared mode: fail if exclusive lock is held
270
+ if (this.exclusiveLocks.has(key)) {
271
+ return null;
272
+ }
273
+ // Increment shared count
274
+ const count = this.sharedLockCounts.get(key) ?? 0;
275
+ this.sharedLockCounts.set(key, count + 1);
276
+ return {
277
+ resource,
278
+ release: async () => {
279
+ const current = this.sharedLockCounts.get(key) ?? 0;
280
+ if (current <= 1) {
281
+ this.sharedLockCounts.delete(key);
282
+ }
283
+ else {
284
+ this.sharedLockCounts.set(key, current - 1);
285
+ }
286
+ },
287
+ };
288
+ }
289
+ else {
290
+ // Exclusive mode: fail if any lock (shared or exclusive) is held
291
+ if (this.exclusiveLocks.has(key)) {
292
+ return null;
293
+ }
294
+ if ((this.sharedLockCounts.get(key) ?? 0) > 0) {
295
+ return null;
296
+ }
297
+ const now = new Date();
298
+ const state = {
299
+ holder: `.process (pid=${process.pid}, bootId="in-memory", startTime=0, command="test")`,
300
+ operation,
301
+ acquiredAt: now,
302
+ expiresAt: none,
303
+ };
304
+ this.exclusiveLocks.set(key, state);
305
+ return {
306
+ resource,
307
+ release: async () => {
308
+ this.exclusiveLocks.delete(key);
309
+ },
310
+ };
311
+ }
312
+ }
313
+ async getState(repo, resource) {
314
+ return this.exclusiveLocks.get(this.makeLockKey(repo, resource)) ?? null;
315
+ }
316
+ async isHolderAlive(_holder) {
317
+ return true;
318
+ }
319
+ clear() {
320
+ this.exclusiveLocks.clear();
321
+ this.sharedLockCounts.clear();
322
+ }
323
+ }
324
+ /**
325
+ * In-memory implementation of LogStore for testing.
326
+ */
327
+ /* eslint-disable @typescript-eslint/require-await */
328
+ class InMemoryLogStore {
329
+ logs = new Map();
330
+ makeLogKey(repo, taskHash, inputsHash, executionId, stream) {
331
+ return `${repo}:${taskHash}:${inputsHash}:${executionId}:${stream}`;
332
+ }
333
+ async append(repo, taskHash, inputsHash, executionId, stream, data) {
334
+ const key = this.makeLogKey(repo, taskHash, inputsHash, executionId, stream);
335
+ const existing = this.logs.get(key) ?? '';
336
+ this.logs.set(key, existing + data);
337
+ }
338
+ async read(repo, taskHash, inputsHash, executionId, stream, options) {
339
+ const key = this.makeLogKey(repo, taskHash, inputsHash, executionId, stream);
340
+ const content = this.logs.get(key) ?? '';
341
+ const offset = options?.offset ?? 0;
342
+ const limit = options?.limit ?? content.length - offset;
343
+ const data = content.slice(offset, offset + limit);
344
+ return {
345
+ data,
346
+ offset,
347
+ size: data.length,
348
+ totalSize: content.length,
349
+ complete: offset + data.length >= content.length,
350
+ };
351
+ }
352
+ clear() {
353
+ this.logs.clear();
354
+ }
355
+ }
356
+ /**
357
+ * In-memory implementation of DatasetRefStore for testing.
358
+ */
359
+ /* eslint-disable @typescript-eslint/require-await */
360
+ class InMemoryDatasetRefStore {
361
+ // Key: "repo:ws:path"
362
+ refs = new Map();
363
+ makeKey(repo, ws, path) {
364
+ return `${repo}:${ws}:${path}`;
365
+ }
366
+ makePrefix(repo, ws) {
367
+ return `${repo}:${ws}:`;
368
+ }
369
+ async read(repo, ws, path) {
370
+ return this.refs.get(this.makeKey(repo, ws, path)) ?? null;
371
+ }
372
+ async write(repo, ws, path, ref) {
373
+ this.refs.set(this.makeKey(repo, ws, path), ref);
374
+ }
375
+ async list(repo, ws) {
376
+ const prefix = this.makePrefix(repo, ws);
377
+ const paths = [];
378
+ for (const key of this.refs.keys()) {
379
+ if (key.startsWith(prefix)) {
380
+ paths.push(key.slice(prefix.length));
381
+ }
382
+ }
383
+ return paths;
384
+ }
385
+ async remove(repo, ws, path) {
386
+ this.refs.delete(this.makeKey(repo, ws, path));
387
+ }
388
+ async removeAll(repo, ws) {
389
+ const prefix = this.makePrefix(repo, ws);
390
+ for (const key of [...this.refs.keys()]) {
391
+ if (key.startsWith(prefix)) {
392
+ this.refs.delete(key);
393
+ }
394
+ }
395
+ }
396
+ clear() {
397
+ this.refs.clear();
398
+ }
399
+ }
400
+ /**
401
+ * In-memory implementation of StorageBackend for testing.
402
+ *
403
+ * All data is stored in memory maps. Useful for unit tests
404
+ * where filesystem access is not needed.
405
+ */
406
+ export class InMemoryStorage {
407
+ objects;
408
+ refs;
409
+ locks;
410
+ logs;
411
+ repos;
412
+ datasets;
413
+ constructor() {
414
+ this.objects = new InMemoryObjectStore();
415
+ this.refs = new InMemoryRefStore();
416
+ this.locks = new InMemoryLockService();
417
+ this.logs = new InMemoryLogStore();
418
+ this.repos = new InMemoryRepoStore();
419
+ this.datasets = new InMemoryDatasetRefStore();
420
+ }
421
+ async validateRepository(repo) {
422
+ if (!(await this.repos.exists(repo))) {
423
+ throw new RepoNotFoundError(repo);
424
+ }
425
+ }
426
+ /**
427
+ * Clear all stored data.
428
+ * Useful for test cleanup.
429
+ */
430
+ clear() {
431
+ this.objects.clear();
432
+ this.refs.clear();
433
+ this.locks.clear();
434
+ this.logs.clear();
435
+ this.repos.clear();
436
+ this.datasets.clear();
437
+ }
438
+ }
439
+ //# sourceMappingURL=InMemoryStorage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InMemoryStorage.js","sourceRoot":"","sources":["../../../../src/storage/in-memory/InMemoryStorage.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE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AAC,EAAE,CAAC;YACrC,MAAM,IAAI,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,KAAK;QACH,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QAClB,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACnB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QAClB,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACnB,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;CACF"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ /**
6
+ * In-memory implementation of StorageBackend for testing.
7
+ *
8
+ * Provides complete storage functionality without filesystem dependencies.
9
+ */
10
+ export { InMemoryStorage } from './InMemoryStorage.js';
11
+ export { InMemoryRepoStore } from './InMemoryRepoStore.js';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/in-memory/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ /**
6
+ * In-memory implementation of StorageBackend for testing.
7
+ *
8
+ * Provides complete storage functionality without filesystem dependencies.
9
+ */
10
+ export { InMemoryStorage } from './InMemoryStorage.js';
11
+ export { InMemoryRepoStore } from './InMemoryRepoStore.js';
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/storage/in-memory/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Storage abstraction layer for e3 repositories.
7
+ *
8
+ * This module provides interfaces that enable e3-core logic to work against
9
+ * different storage backends:
10
+ * - LocalBackend: Filesystem (default, for CLI and local dev)
11
+ * - EfsBackend: AWS EFS (for Lambda/Fargate cloud deployment)
12
+ * - S3DynamoBackend: S3 + DynamoDB (future optimization)
13
+ */
14
+ export { type ObjectStore, type RefStore, type LockHandle, type LockService, type LockState, type LockOperation, type LockHolderInfo, type LogChunk, type LogStore, type RepoStore, type RepoStatus, type RepoMetadata, type BatchResult, type GcRootScanResult, type GcObjectEntry, type GcObjectScanResult, type DatasetRefStore, type StorageBackend, } from './interfaces.js';
15
+ export { LocalStorage, LocalBackend, // Backwards compatibility alias for LocalStorage
16
+ LocalObjectStore, LocalRefStore, LocalLockService, LocalLogStore, LocalRepoStore, LocalDatasetRefStore, } from './local/index.js';
17
+ export { InMemoryStorage, InMemoryRepoStore, } from './in-memory/index.js';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAGH,OAAO,EAEL,KAAK,WAAW,EAEhB,KAAK,QAAQ,EAEb,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,cAAc,EAEnB,KAAK,QAAQ,EACb,KAAK,QAAQ,EAEb,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,WAAW,EAEhB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EAEvB,KAAK,eAAe,EAEpB,KAAK,cAAc,GACpB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,YAAY,EACZ,YAAY,EAAG,iDAAiD;AAChE,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,eAAe,EACf,iBAAiB,GAClB,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ // Local filesystem implementation
6
+ export { LocalStorage, LocalBackend, // Backwards compatibility alias for LocalStorage
7
+ LocalObjectStore, LocalRefStore, LocalLockService, LocalLogStore, LocalRepoStore, LocalDatasetRefStore, } from './local/index.js';
8
+ // In-memory implementation (for testing)
9
+ export { InMemoryStorage, InMemoryRepoStore, } from './in-memory/index.js';
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/storage/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA0CH,kCAAkC;AAClC,OAAO,EACL,YAAY,EACZ,YAAY,EAAG,iDAAiD;AAChE,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAE1B,yCAAyC;AACzC,OAAO,EACL,eAAe,EACf,iBAAiB,GAClB,MAAM,sBAAsB,CAAC"}