@elaraai/e3-types 0.0.2-beta.12 → 0.0.2-beta.14
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/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/lock.d.ts +81 -0
- package/dist/src/lock.d.ts.map +1 -0
- package/dist/src/lock.js +69 -0
- package/dist/src/lock.js.map +1 -0
- package/package.json +1 -1
- package/src/index.ts +10 -0
- package/src/lock.ts +88 -0
package/dist/src/index.d.ts
CHANGED
|
@@ -26,4 +26,5 @@ export { StructureType, type Structure, PathSegmentType, type PathSegment, TreeP
|
|
|
26
26
|
export { PackageDataType, type PackageData, PackageObjectType, type PackageObject, PackageDatasetsType, type PackageDatasets, } from './package.js';
|
|
27
27
|
export { WorkspaceStateType, type WorkspaceState, } from './workspace.js';
|
|
28
28
|
export { ExecutionStatusType, type ExecutionStatus, } from './execution.js';
|
|
29
|
+
export { LockOperationType, type LockOperation, ProcessHolderType, type ProcessHolder, LockStateType, type LockState, } from './lock.js';
|
|
29
30
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EACL,WAAW,EACX,KAAK,OAAO,EACZ,aAAa,EACb,OAAO,EACP,YAAY,GACb,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,cAAc,EACd,KAAK,UAAU,GAChB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,aAAa,EACb,KAAK,SAAS,EACd,eAAe,EACf,KAAK,WAAW,EAChB,YAAY,EACZ,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EAEjB,iBAAiB,EACjB,KAAK,aAAa,GACnB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,eAAe,EACf,KAAK,WAAW,EAChB,iBAAiB,EACjB,KAAK,aAAa,EAElB,mBAAmB,EACnB,KAAK,eAAe,GACrB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,kBAAkB,EAClB,KAAK,cAAc,GACpB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,mBAAmB,EACnB,KAAK,eAAe,GACrB,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EACL,WAAW,EACX,KAAK,OAAO,EACZ,aAAa,EACb,OAAO,EACP,YAAY,GACb,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,cAAc,EACd,KAAK,UAAU,GAChB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,aAAa,EACb,KAAK,SAAS,EACd,eAAe,EACf,KAAK,WAAW,EAChB,YAAY,EACZ,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EAEjB,iBAAiB,EACjB,KAAK,aAAa,GACnB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,eAAe,EACf,KAAK,WAAW,EAChB,iBAAiB,EACjB,KAAK,aAAa,EAElB,mBAAmB,EACnB,KAAK,eAAe,GACrB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,kBAAkB,EAClB,KAAK,cAAc,GACpB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,mBAAmB,EACnB,KAAK,eAAe,GACrB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,iBAAiB,EACjB,KAAK,aAAa,EAClB,iBAAiB,EACjB,KAAK,aAAa,EAClB,aAAa,EACb,KAAK,SAAS,GACf,MAAM,WAAW,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -36,4 +36,6 @@ PackageDatasetsType, } from './package.js';
|
|
|
36
36
|
export { WorkspaceStateType, } from './workspace.js';
|
|
37
37
|
// Execution status
|
|
38
38
|
export { ExecutionStatusType, } from './execution.js';
|
|
39
|
+
// Lock state
|
|
40
|
+
export { LockOperationType, ProcessHolderType, LockStateType, } from './lock.js';
|
|
39
41
|
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AAEH,4BAA4B;AAC5B,OAAO,EACL,WAAW,EAEX,aAAa,EACb,OAAO,EACP,YAAY,GACb,MAAM,cAAc,CAAC;AAEtB,mBAAmB;AACnB,OAAO,EACL,cAAc,GAEf,MAAM,WAAW,CAAC;AAEnB,2BAA2B;AAC3B,OAAO,EACL,aAAa,EAEb,eAAe,EAEf,YAAY,EAKZ,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,iBAAiB;AACjB,0BAA0B;AAC1B,iBAAiB,GAElB,MAAM,gBAAgB,CAAC;AAExB,kBAAkB;AAClB,OAAO,EACL,eAAe,EAEf,iBAAiB;AAEjB,0BAA0B;AAC1B,mBAAmB,GAEpB,MAAM,cAAc,CAAC;AAEtB,kBAAkB;AAClB,OAAO,EACL,kBAAkB,GAEnB,MAAM,gBAAgB,CAAC;AAExB,mBAAmB;AACnB,OAAO,EACL,mBAAmB,GAEpB,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AAEH,4BAA4B;AAC5B,OAAO,EACL,WAAW,EAEX,aAAa,EACb,OAAO,EACP,YAAY,GACb,MAAM,cAAc,CAAC;AAEtB,mBAAmB;AACnB,OAAO,EACL,cAAc,GAEf,MAAM,WAAW,CAAC;AAEnB,2BAA2B;AAC3B,OAAO,EACL,aAAa,EAEb,eAAe,EAEf,YAAY,EAKZ,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,iBAAiB;AACjB,0BAA0B;AAC1B,iBAAiB,GAElB,MAAM,gBAAgB,CAAC;AAExB,kBAAkB;AAClB,OAAO,EACL,eAAe,EAEf,iBAAiB;AAEjB,0BAA0B;AAC1B,mBAAmB,GAEpB,MAAM,cAAc,CAAC;AAEtB,kBAAkB;AAClB,OAAO,EACL,kBAAkB,GAEnB,MAAM,gBAAgB,CAAC;AAExB,mBAAmB;AACnB,OAAO,EACL,mBAAmB,GAEpB,MAAM,gBAAgB,CAAC;AAExB,aAAa;AACb,OAAO,EACL,iBAAiB,EAEjB,iBAAiB,EAEjB,aAAa,GAEd,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Lock state type definitions.
|
|
7
|
+
*
|
|
8
|
+
* A lock provides exclusive access to a workspace. The state tracks:
|
|
9
|
+
* - What operation acquired the lock (dataflow, deployment, etc.)
|
|
10
|
+
* - Who holds the lock (East text-encoded string)
|
|
11
|
+
* - When it was acquired
|
|
12
|
+
* - Optional expiry (for cloud TTL-based locks)
|
|
13
|
+
*
|
|
14
|
+
* Lock file location: workspaces/<name>.lock
|
|
15
|
+
*
|
|
16
|
+
* The holder field is an East text-encoded string, allowing different backends
|
|
17
|
+
* to encode their own holder identification. Common patterns:
|
|
18
|
+
* - Local: `.process (pid=1234, bootId="abc-123", startTime=98765, command="e3 start")`
|
|
19
|
+
* - Cloud: `.lambda (requestId="req-123", functionName="e3-api")`
|
|
20
|
+
*/
|
|
21
|
+
import { VariantType, StructType, StringType, IntegerType, DateTimeType, OptionType, NullType, ValueTypeOf } from '@elaraai/east';
|
|
22
|
+
/**
|
|
23
|
+
* Lock operation - what acquired the lock.
|
|
24
|
+
*/
|
|
25
|
+
export declare const LockOperationType: VariantType<{
|
|
26
|
+
/** Running a dataflow */
|
|
27
|
+
readonly dataflow: NullType;
|
|
28
|
+
/** Deploying a package to the workspace */
|
|
29
|
+
readonly deployment: NullType;
|
|
30
|
+
/** Removing the workspace */
|
|
31
|
+
readonly removal: NullType;
|
|
32
|
+
/** Writing to a dataset */
|
|
33
|
+
readonly dataset_write: NullType;
|
|
34
|
+
}>;
|
|
35
|
+
export type LockOperation = ValueTypeOf<typeof LockOperationType>;
|
|
36
|
+
/**
|
|
37
|
+
* Process holder schema - for local filesystem backends.
|
|
38
|
+
* Used to encode/decode the holder string.
|
|
39
|
+
*/
|
|
40
|
+
export declare const ProcessHolderType: StructType<{
|
|
41
|
+
/** Process ID */
|
|
42
|
+
readonly pid: IntegerType;
|
|
43
|
+
/** System boot ID (from /proc/sys/kernel/random/boot_id) */
|
|
44
|
+
readonly bootId: StringType;
|
|
45
|
+
/** Process start time in jiffies since boot */
|
|
46
|
+
readonly startTime: IntegerType;
|
|
47
|
+
/** Command that acquired the lock (for debugging) */
|
|
48
|
+
readonly command: StringType;
|
|
49
|
+
}>;
|
|
50
|
+
export type ProcessHolder = ValueTypeOf<typeof ProcessHolderType>;
|
|
51
|
+
/**
|
|
52
|
+
* Lock state stored in workspaces/<name>.lock
|
|
53
|
+
*
|
|
54
|
+
* Represents an advisory lock on a workspace. The actual locking mechanism
|
|
55
|
+
* is platform-specific (flock on Linux, DynamoDB conditional writes in cloud),
|
|
56
|
+
* but the lock content follows this schema.
|
|
57
|
+
*
|
|
58
|
+
* The holder field is an East text-encoded string representing a variant value.
|
|
59
|
+
* Use `printFor`/`parseInferred` from @elaraai/east to encode/decode.
|
|
60
|
+
*/
|
|
61
|
+
export declare const LockStateType: StructType<{
|
|
62
|
+
/** What operation acquired the lock */
|
|
63
|
+
readonly operation: VariantType<{
|
|
64
|
+
/** Running a dataflow */
|
|
65
|
+
readonly dataflow: NullType;
|
|
66
|
+
/** Deploying a package to the workspace */
|
|
67
|
+
readonly deployment: NullType;
|
|
68
|
+
/** Removing the workspace */
|
|
69
|
+
readonly removal: NullType;
|
|
70
|
+
/** Writing to a dataset */
|
|
71
|
+
readonly dataset_write: NullType;
|
|
72
|
+
}>;
|
|
73
|
+
/** Who holds the lock - East text-encoded variant (e.g., `.process (...)`) */
|
|
74
|
+
readonly holder: StringType;
|
|
75
|
+
/** When the lock was acquired */
|
|
76
|
+
readonly acquiredAt: DateTimeType;
|
|
77
|
+
/** When the lock expires (for cloud TTL-based locks) */
|
|
78
|
+
readonly expiresAt: OptionType<DateTimeType>;
|
|
79
|
+
}>;
|
|
80
|
+
export type LockState = ValueTypeOf<typeof LockStateType>;
|
|
81
|
+
//# sourceMappingURL=lock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lock.d.ts","sourceRoot":"","sources":["../../src/lock.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EACL,WAAW,EACX,UAAU,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,WAAW,EACZ,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,eAAO,MAAM,iBAAiB;IAC5B,yBAAyB;;IAEzB,2CAA2C;;IAE3C,6BAA6B;;IAE7B,2BAA2B;;EAE3B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE;;;GAGG;AACH,eAAO,MAAM,iBAAiB;IAC5B,iBAAiB;;IAEjB,4DAA4D;;IAE5D,+CAA+C;;IAE/C,qDAAqD;;EAErD,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa;IACxB,uCAAuC;;QAxCvC,yBAAyB;;QAEzB,2CAA2C;;QAE3C,6BAA6B;;QAE7B,2BAA2B;;;IAoC3B,8EAA8E;;IAE9E,iCAAiC;;IAEjC,wDAAwD;;EAExD,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,WAAW,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
package/dist/src/lock.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Lock state type definitions.
|
|
7
|
+
*
|
|
8
|
+
* A lock provides exclusive access to a workspace. The state tracks:
|
|
9
|
+
* - What operation acquired the lock (dataflow, deployment, etc.)
|
|
10
|
+
* - Who holds the lock (East text-encoded string)
|
|
11
|
+
* - When it was acquired
|
|
12
|
+
* - Optional expiry (for cloud TTL-based locks)
|
|
13
|
+
*
|
|
14
|
+
* Lock file location: workspaces/<name>.lock
|
|
15
|
+
*
|
|
16
|
+
* The holder field is an East text-encoded string, allowing different backends
|
|
17
|
+
* to encode their own holder identification. Common patterns:
|
|
18
|
+
* - Local: `.process (pid=1234, bootId="abc-123", startTime=98765, command="e3 start")`
|
|
19
|
+
* - Cloud: `.lambda (requestId="req-123", functionName="e3-api")`
|
|
20
|
+
*/
|
|
21
|
+
import { VariantType, StructType, StringType, IntegerType, DateTimeType, OptionType, NullType, } from '@elaraai/east';
|
|
22
|
+
/**
|
|
23
|
+
* Lock operation - what acquired the lock.
|
|
24
|
+
*/
|
|
25
|
+
export const LockOperationType = VariantType({
|
|
26
|
+
/** Running a dataflow */
|
|
27
|
+
dataflow: NullType,
|
|
28
|
+
/** Deploying a package to the workspace */
|
|
29
|
+
deployment: NullType,
|
|
30
|
+
/** Removing the workspace */
|
|
31
|
+
removal: NullType,
|
|
32
|
+
/** Writing to a dataset */
|
|
33
|
+
dataset_write: NullType,
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* Process holder schema - for local filesystem backends.
|
|
37
|
+
* Used to encode/decode the holder string.
|
|
38
|
+
*/
|
|
39
|
+
export const ProcessHolderType = StructType({
|
|
40
|
+
/** Process ID */
|
|
41
|
+
pid: IntegerType,
|
|
42
|
+
/** System boot ID (from /proc/sys/kernel/random/boot_id) */
|
|
43
|
+
bootId: StringType,
|
|
44
|
+
/** Process start time in jiffies since boot */
|
|
45
|
+
startTime: IntegerType,
|
|
46
|
+
/** Command that acquired the lock (for debugging) */
|
|
47
|
+
command: StringType,
|
|
48
|
+
});
|
|
49
|
+
/**
|
|
50
|
+
* Lock state stored in workspaces/<name>.lock
|
|
51
|
+
*
|
|
52
|
+
* Represents an advisory lock on a workspace. The actual locking mechanism
|
|
53
|
+
* is platform-specific (flock on Linux, DynamoDB conditional writes in cloud),
|
|
54
|
+
* but the lock content follows this schema.
|
|
55
|
+
*
|
|
56
|
+
* The holder field is an East text-encoded string representing a variant value.
|
|
57
|
+
* Use `printFor`/`parseInferred` from @elaraai/east to encode/decode.
|
|
58
|
+
*/
|
|
59
|
+
export const LockStateType = StructType({
|
|
60
|
+
/** What operation acquired the lock */
|
|
61
|
+
operation: LockOperationType,
|
|
62
|
+
/** Who holds the lock - East text-encoded variant (e.g., `.process (...)`) */
|
|
63
|
+
holder: StringType,
|
|
64
|
+
/** When the lock was acquired */
|
|
65
|
+
acquiredAt: DateTimeType,
|
|
66
|
+
/** When the lock expires (for cloud TTL-based locks) */
|
|
67
|
+
expiresAt: OptionType(DateTimeType),
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=lock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lock.js","sourceRoot":"","sources":["../../src/lock.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EACL,WAAW,EACX,UAAU,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACZ,UAAU,EACV,QAAQ,GAET,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,WAAW,CAAC;IAC3C,yBAAyB;IACzB,QAAQ,EAAE,QAAQ;IAClB,2CAA2C;IAC3C,UAAU,EAAE,QAAQ;IACpB,6BAA6B;IAC7B,OAAO,EAAE,QAAQ;IACjB,2BAA2B;IAC3B,aAAa,EAAE,QAAQ;CACxB,CAAC,CAAC;AAIH;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAAC;IAC1C,iBAAiB;IACjB,GAAG,EAAE,WAAW;IAChB,4DAA4D;IAC5D,MAAM,EAAE,UAAU;IAClB,+CAA+C;IAC/C,SAAS,EAAE,WAAW;IACtB,qDAAqD;IACrD,OAAO,EAAE,UAAU;CACpB,CAAC,CAAC;AAIH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAC;IACtC,uCAAuC;IACvC,SAAS,EAAE,iBAAiB;IAC5B,8EAA8E;IAC9E,MAAM,EAAE,UAAU;IAClB,iCAAiC;IACjC,UAAU,EAAE,YAAY;IACxB,wDAAwD;IACxD,SAAS,EAAE,UAAU,CAAC,YAAY,CAAC;CACpC,CAAC,CAAC"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -81,3 +81,13 @@ export {
|
|
|
81
81
|
ExecutionStatusType,
|
|
82
82
|
type ExecutionStatus,
|
|
83
83
|
} from './execution.js';
|
|
84
|
+
|
|
85
|
+
// Lock state
|
|
86
|
+
export {
|
|
87
|
+
LockOperationType,
|
|
88
|
+
type LockOperation,
|
|
89
|
+
ProcessHolderType,
|
|
90
|
+
type ProcessHolder,
|
|
91
|
+
LockStateType,
|
|
92
|
+
type LockState,
|
|
93
|
+
} from './lock.js';
|
package/src/lock.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Lock state type definitions.
|
|
8
|
+
*
|
|
9
|
+
* A lock provides exclusive access to a workspace. The state tracks:
|
|
10
|
+
* - What operation acquired the lock (dataflow, deployment, etc.)
|
|
11
|
+
* - Who holds the lock (East text-encoded string)
|
|
12
|
+
* - When it was acquired
|
|
13
|
+
* - Optional expiry (for cloud TTL-based locks)
|
|
14
|
+
*
|
|
15
|
+
* Lock file location: workspaces/<name>.lock
|
|
16
|
+
*
|
|
17
|
+
* The holder field is an East text-encoded string, allowing different backends
|
|
18
|
+
* to encode their own holder identification. Common patterns:
|
|
19
|
+
* - Local: `.process (pid=1234, bootId="abc-123", startTime=98765, command="e3 start")`
|
|
20
|
+
* - Cloud: `.lambda (requestId="req-123", functionName="e3-api")`
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import {
|
|
24
|
+
VariantType,
|
|
25
|
+
StructType,
|
|
26
|
+
StringType,
|
|
27
|
+
IntegerType,
|
|
28
|
+
DateTimeType,
|
|
29
|
+
OptionType,
|
|
30
|
+
NullType,
|
|
31
|
+
ValueTypeOf,
|
|
32
|
+
} from '@elaraai/east';
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Lock operation - what acquired the lock.
|
|
36
|
+
*/
|
|
37
|
+
export const LockOperationType = VariantType({
|
|
38
|
+
/** Running a dataflow */
|
|
39
|
+
dataflow: NullType,
|
|
40
|
+
/** Deploying a package to the workspace */
|
|
41
|
+
deployment: NullType,
|
|
42
|
+
/** Removing the workspace */
|
|
43
|
+
removal: NullType,
|
|
44
|
+
/** Writing to a dataset */
|
|
45
|
+
dataset_write: NullType,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export type LockOperation = ValueTypeOf<typeof LockOperationType>;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Process holder schema - for local filesystem backends.
|
|
52
|
+
* Used to encode/decode the holder string.
|
|
53
|
+
*/
|
|
54
|
+
export const ProcessHolderType = StructType({
|
|
55
|
+
/** Process ID */
|
|
56
|
+
pid: IntegerType,
|
|
57
|
+
/** System boot ID (from /proc/sys/kernel/random/boot_id) */
|
|
58
|
+
bootId: StringType,
|
|
59
|
+
/** Process start time in jiffies since boot */
|
|
60
|
+
startTime: IntegerType,
|
|
61
|
+
/** Command that acquired the lock (for debugging) */
|
|
62
|
+
command: StringType,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export type ProcessHolder = ValueTypeOf<typeof ProcessHolderType>;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Lock state stored in workspaces/<name>.lock
|
|
69
|
+
*
|
|
70
|
+
* Represents an advisory lock on a workspace. The actual locking mechanism
|
|
71
|
+
* is platform-specific (flock on Linux, DynamoDB conditional writes in cloud),
|
|
72
|
+
* but the lock content follows this schema.
|
|
73
|
+
*
|
|
74
|
+
* The holder field is an East text-encoded string representing a variant value.
|
|
75
|
+
* Use `printFor`/`parseInferred` from @elaraai/east to encode/decode.
|
|
76
|
+
*/
|
|
77
|
+
export const LockStateType = StructType({
|
|
78
|
+
/** What operation acquired the lock */
|
|
79
|
+
operation: LockOperationType,
|
|
80
|
+
/** Who holds the lock - East text-encoded variant (e.g., `.process (...)`) */
|
|
81
|
+
holder: StringType,
|
|
82
|
+
/** When the lock was acquired */
|
|
83
|
+
acquiredAt: DateTimeType,
|
|
84
|
+
/** When the lock expires (for cloud TTL-based locks) */
|
|
85
|
+
expiresAt: OptionType(DateTimeType),
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
export type LockState = ValueTypeOf<typeof LockStateType>;
|