@lix-js/sdk 0.6.0-preview.3 → 0.6.0-preview.5
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 +1 -1
- package/SKILL.md +105 -65
- package/dist/engine-wasm/index.js +4 -4
- package/dist/engine-wasm/wasm/lix_engine.d.ts +30 -6
- package/dist/engine-wasm/wasm/lix_engine.js +187 -117
- package/dist/engine-wasm/wasm/lix_engine.wasm +0 -0
- package/dist/engine-wasm/wasm/lix_engine.wasm.d.ts +14 -8
- package/dist/generated/builtin-schemas.d.ts +69 -69
- package/dist/generated/builtin-schemas.js +94 -94
- package/dist/open-lix.d.ts +42 -28
- package/dist/open-lix.js +49 -10
- package/dist/sqlite/index.js +86 -30
- package/dist-engine-src/README.md +3 -3
- package/dist-engine-src/src/backend/capabilities.rs +67 -0
- package/dist-engine-src/src/backend/conformance/baseline.rs +1127 -0
- package/dist-engine-src/src/backend/conformance/factory.rs +93 -0
- package/dist-engine-src/src/backend/conformance/failure_tests.rs +608 -0
- package/dist-engine-src/src/backend/conformance/fixtures.rs +26 -0
- package/dist-engine-src/src/backend/conformance/mod.rs +75 -0
- package/dist-engine-src/src/backend/conformance/model.rs +28 -0
- package/dist-engine-src/src/backend/conformance/model_based.rs +257 -0
- package/dist-engine-src/src/backend/conformance/persistence.rs +204 -0
- package/dist-engine-src/src/backend/conformance/projection.rs +21 -0
- package/dist-engine-src/src/backend/conformance/pushdown.rs +24 -0
- package/dist-engine-src/src/backend/conformance/runner.rs +90 -0
- package/dist-engine-src/src/backend/conformance/scan.rs +24 -0
- package/dist-engine-src/src/backend/conformance/write.rs +16 -0
- package/dist-engine-src/src/backend/error.rs +94 -0
- package/dist-engine-src/src/backend/in_memory.rs +670 -0
- package/dist-engine-src/src/backend/mod.rs +36 -9
- package/dist-engine-src/src/backend/predicate.rs +80 -0
- package/dist-engine-src/src/backend/traits.rs +260 -0
- package/dist-engine-src/src/backend/types.rs +224 -81
- package/dist-engine-src/src/binary_cas/context.rs +8 -8
- package/dist-engine-src/src/binary_cas/kv.rs +234 -259
- package/dist-engine-src/src/{version → branch}/context.rs +12 -12
- package/dist-engine-src/src/branch/lifecycle.rs +221 -0
- package/dist-engine-src/src/branch/mod.rs +13 -0
- package/dist-engine-src/src/branch/refs.rs +321 -0
- package/dist-engine-src/src/branch/stage_rows.rs +67 -0
- package/dist-engine-src/src/branch/types.rs +21 -0
- package/dist-engine-src/src/catalog/context.rs +18 -18
- package/dist-engine-src/src/catalog/snapshot.rs +8 -8
- package/dist-engine-src/src/changelog/bench_support.rs +785 -0
- package/dist-engine-src/src/changelog/change.rs +1 -0
- package/dist-engine-src/src/changelog/codec.rs +497 -0
- package/dist-engine-src/src/changelog/commit.rs +1 -0
- package/dist-engine-src/src/changelog/context.rs +1614 -0
- package/dist-engine-src/src/changelog/mod.rs +29 -0
- package/dist-engine-src/src/changelog/store.rs +163 -0
- package/dist-engine-src/src/changelog/test_support.rs +54 -0
- package/dist-engine-src/src/changelog/types.rs +213 -0
- package/dist-engine-src/src/commit_graph/context.rs +317 -274
- package/dist-engine-src/src/commit_graph/mod.rs +2 -4
- package/dist-engine-src/src/commit_graph/types.rs +22 -42
- package/dist-engine-src/src/commit_graph/walker.rs +133 -103
- package/dist-engine-src/src/common/error.rs +52 -18
- package/dist-engine-src/src/common/identity.rs +2 -2
- package/dist-engine-src/src/common/mod.rs +1 -1
- package/dist-engine-src/src/domain.rs +42 -46
- package/dist-engine-src/src/engine.rs +74 -96
- package/dist-engine-src/src/{entity_identity.rs → entity_pk.rs} +89 -92
- package/dist-engine-src/src/functions/context.rs +56 -52
- package/dist-engine-src/src/functions/state.rs +51 -52
- package/dist-engine-src/src/init.rs +288 -154
- package/dist-engine-src/src/json_store/context.rs +15 -266
- package/dist-engine-src/src/json_store/mod.rs +26 -0
- package/dist-engine-src/src/json_store/store.rs +103 -718
- package/dist-engine-src/src/json_store/types.rs +4 -9
- package/dist-engine-src/src/lib.rs +49 -19
- package/dist-engine-src/src/live_state/context.rs +654 -790
- package/dist-engine-src/src/live_state/mod.rs +9 -3
- package/dist-engine-src/src/live_state/overlay.rs +4 -4
- package/dist-engine-src/src/live_state/types.rs +30 -21
- package/dist-engine-src/src/live_state/visibility.rs +514 -71
- package/dist-engine-src/src/plugin/install.rs +48 -48
- package/dist-engine-src/src/plugin/manifest.rs +7 -7
- package/dist-engine-src/src/plugin/materializer.rs +0 -275
- package/dist-engine-src/src/plugin/plugin_manifest.json +4 -3
- package/dist-engine-src/src/schema/builtin/lix_binary_blob_ref.json +2 -2
- package/dist-engine-src/src/schema/builtin/lix_branch_descriptor.json +34 -0
- package/dist-engine-src/src/schema/builtin/lix_branch_ref.json +48 -0
- package/dist-engine-src/src/schema/builtin/lix_change.json +3 -3
- package/dist-engine-src/src/schema/builtin/lix_commit.json +1 -1
- package/dist-engine-src/src/schema/builtin/lix_label_assignment.json +6 -6
- package/dist-engine-src/src/schema/builtin/mod.rs +18 -20
- package/dist-engine-src/src/schema/compatibility.rs +11 -11
- package/dist-engine-src/src/schema/definition.json +2 -2
- package/dist-engine-src/src/schema/definition.rs +5 -5
- package/dist-engine-src/src/schema/key.rs +3 -3
- package/dist-engine-src/src/schema/mod.rs +1 -1
- package/dist-engine-src/src/schema/tests.rs +18 -18
- package/dist-engine-src/src/session/context.rs +819 -124
- package/dist-engine-src/src/session/create_branch.rs +94 -0
- package/dist-engine-src/src/session/execute.rs +260 -57
- package/dist-engine-src/src/session/merge/analysis.rs +9 -3
- package/dist-engine-src/src/session/merge/{version.rs → branch.rs} +119 -129
- package/dist-engine-src/src/session/merge/conflicts.rs +2 -2
- package/dist-engine-src/src/session/merge/mod.rs +5 -6
- package/dist-engine-src/src/session/merge/stats.rs +7 -11
- package/dist-engine-src/src/session/mod.rs +19 -16
- package/dist-engine-src/src/session/switch_branch.rs +113 -0
- package/dist-engine-src/src/session/transaction.rs +557 -0
- package/dist-engine-src/src/sql2/bind/classify.rs +102 -0
- package/dist-engine-src/src/sql2/bind/error.rs +5 -0
- package/dist-engine-src/src/sql2/bind/expr.rs +29 -0
- package/dist-engine-src/src/sql2/bind/mod.rs +12 -0
- package/dist-engine-src/src/sql2/{udfs/public_call.rs → bind/public_udf.rs} +98 -3
- package/dist-engine-src/src/sql2/bind/read.rs +65 -0
- package/dist-engine-src/src/sql2/bind/statement.rs +2236 -0
- package/dist-engine-src/src/sql2/bind/table.rs +273 -0
- package/dist-engine-src/src/sql2/bind/write.rs +86 -0
- package/dist-engine-src/src/sql2/branch_scope.rs +436 -0
- package/dist-engine-src/src/sql2/catalog/capability.rs +20 -0
- package/dist-engine-src/src/sql2/catalog/entity_surface.rs +296 -0
- package/dist-engine-src/src/sql2/catalog/mod.rs +15 -0
- package/dist-engine-src/src/sql2/catalog/registry.rs +556 -0
- package/dist-engine-src/src/sql2/catalog/schema.rs +88 -0
- package/dist-engine-src/src/sql2/catalog/surface.rs +41 -0
- package/dist-engine-src/src/sql2/change_materialization.rs +122 -0
- package/dist-engine-src/src/sql2/context.rs +36 -30
- package/dist-engine-src/src/sql2/error.rs +4 -5
- package/dist-engine-src/src/sql2/exec/bound_public_write.rs +1593 -0
- package/dist-engine-src/src/sql2/exec/datafusion.rs +5266 -0
- package/dist-engine-src/src/sql2/exec/fast_write.rs +82 -0
- package/dist-engine-src/src/sql2/exec/mod.rs +24 -0
- package/dist-engine-src/src/sql2/exec/write.rs +661 -0
- package/dist-engine-src/src/sql2/filesystem_planner.rs +72 -77
- package/dist-engine-src/src/sql2/filesystem_visibility.rs +21 -21
- package/dist-engine-src/src/sql2/history_projection.rs +8 -8
- package/dist-engine-src/src/sql2/history_route.rs +35 -31
- package/dist-engine-src/src/sql2/mod.rs +30 -24
- package/dist-engine-src/src/sql2/optimize/datafusion.rs +1 -0
- package/dist-engine-src/src/sql2/optimize/mod.rs +2 -0
- package/dist-engine-src/src/sql2/optimize/simple_write.rs +116 -0
- package/dist-engine-src/src/sql2/parse/mod.rs +69 -0
- package/dist-engine-src/src/sql2/parse/normalize.rs +1 -0
- package/dist-engine-src/src/sql2/plan/branch_scope.rs +24 -0
- package/dist-engine-src/src/sql2/plan/mod.rs +5 -0
- package/dist-engine-src/src/sql2/plan/predicate.rs +22 -0
- package/dist-engine-src/src/sql2/plan/write.rs +147 -0
- package/dist-engine-src/src/sql2/predicate_typecheck.rs +258 -0
- package/dist-engine-src/src/sql2/{version_provider.rs → providers/branch.rs} +218 -214
- package/dist-engine-src/src/sql2/{change_provider.rs → providers/change.rs} +156 -42
- package/dist-engine-src/src/sql2/{directory_provider.rs → providers/directory.rs} +291 -322
- package/dist-engine-src/src/sql2/{directory_history_provider.rs → providers/directory_history.rs} +56 -42
- package/dist-engine-src/src/sql2/providers/entity.rs +1484 -0
- package/dist-engine-src/src/sql2/{entity_history_provider.rs → providers/entity_history.rs} +43 -31
- package/dist-engine-src/src/sql2/{file_provider.rs → providers/file.rs} +323 -316
- package/dist-engine-src/src/sql2/{file_history_provider.rs → providers/file_history.rs} +60 -46
- package/dist-engine-src/src/sql2/{history_provider.rs → providers/history.rs} +46 -32
- package/dist-engine-src/src/sql2/{lix_state_provider.rs → providers/lix_state.rs} +359 -329
- package/dist-engine-src/src/sql2/providers/mod.rs +508 -0
- package/dist-engine-src/src/sql2/read_only.rs +2 -2
- package/dist-engine-src/src/sql2/session.rs +47 -96
- package/dist-engine-src/src/sql2/storage/constraints.rs +1 -0
- package/dist-engine-src/src/sql2/storage/mod.rs +1 -0
- package/dist-engine-src/src/sql2/test_support/differential.rs +712 -0
- package/dist-engine-src/src/sql2/test_support/generators.rs +354 -0
- package/dist-engine-src/src/sql2/test_support/mod.rs +2 -0
- package/dist-engine-src/src/sql2/udfs/{lix_active_version_commit_id.rs → lix_active_branch_commit_id.rs} +7 -7
- package/dist-engine-src/src/sql2/udfs/mod.rs +3 -6
- package/dist-engine-src/src/sql2/write_normalization.rs +45 -22
- package/dist-engine-src/src/storage/conformance.rs +399 -0
- package/dist-engine-src/src/storage/context.rs +552 -288
- package/dist-engine-src/src/storage/mod.rs +48 -10
- package/dist-engine-src/src/storage/point.rs +440 -0
- package/dist-engine-src/src/storage/read_scope.rs +43 -64
- package/dist-engine-src/src/storage/reader.rs +867 -0
- package/dist-engine-src/src/storage/scan.rs +784 -0
- package/dist-engine-src/src/storage/spaces.rs +236 -0
- package/dist-engine-src/src/storage/stats.rs +80 -0
- package/dist-engine-src/src/storage/write_set.rs +962 -0
- package/dist-engine-src/src/storage_bench.rs +136 -4828
- package/dist-engine-src/src/test_support.rs +360 -138
- package/dist-engine-src/src/tracked_state/bench_support.rs +394 -0
- package/dist-engine-src/src/tracked_state/codec.rs +155 -1057
- package/dist-engine-src/src/tracked_state/commit_root_rebuild.rs +358 -0
- package/dist-engine-src/src/tracked_state/context.rs +1927 -993
- package/dist-engine-src/src/tracked_state/diff.rs +1715 -261
- package/dist-engine-src/src/tracked_state/merge.rs +74 -88
- package/dist-engine-src/src/tracked_state/mod.rs +19 -16
- package/dist-engine-src/src/tracked_state/{materialization.rs → row_materialization.rs} +50 -178
- package/dist-engine-src/src/tracked_state/storage.rs +243 -191
- package/dist-engine-src/src/tracked_state/tree.rs +247 -371
- package/dist-engine-src/src/tracked_state/types.rs +49 -42
- package/dist-engine-src/src/transaction/bench_support.rs +407 -0
- package/dist-engine-src/src/transaction/commit.rs +821 -713
- package/dist-engine-src/src/transaction/context.rs +705 -600
- package/dist-engine-src/src/transaction/mod.rs +13 -2
- package/dist-engine-src/src/transaction/normalization.rs +63 -76
- package/dist-engine-src/src/transaction/prep.rs +13 -13
- package/dist-engine-src/src/transaction/schema_resolver.rs +19 -5
- package/dist-engine-src/src/transaction/staging.rs +228 -434
- package/dist-engine-src/src/transaction/types.rs +41 -98
- package/dist-engine-src/src/transaction/validation.rs +382 -446
- package/dist-engine-src/src/untracked_state/codec.rs +337 -29
- package/dist-engine-src/src/untracked_state/context.rs +7 -7
- package/dist-engine-src/src/untracked_state/materialization.rs +2 -2
- package/dist-engine-src/src/untracked_state/mod.rs +1 -1
- package/dist-engine-src/src/untracked_state/storage.rs +659 -157
- package/dist-engine-src/src/untracked_state/types.rs +21 -21
- package/package.json +71 -68
- package/dist-engine-src/src/backend/kv.rs +0 -358
- package/dist-engine-src/src/backend/testing.rs +0 -658
- package/dist-engine-src/src/commit_store/codec.rs +0 -887
- package/dist-engine-src/src/commit_store/context.rs +0 -944
- package/dist-engine-src/src/commit_store/materialization.rs +0 -84
- package/dist-engine-src/src/commit_store/mod.rs +0 -16
- package/dist-engine-src/src/commit_store/storage.rs +0 -600
- package/dist-engine-src/src/commit_store/types.rs +0 -215
- package/dist-engine-src/src/schema/builtin/lix_version_descriptor.json +0 -34
- package/dist-engine-src/src/schema/builtin/lix_version_ref.json +0 -48
- package/dist-engine-src/src/session/create_version.rs +0 -88
- package/dist-engine-src/src/session/merge/apply.rs +0 -23
- package/dist-engine-src/src/session/optimization9_sql2_bench.rs +0 -100
- package/dist-engine-src/src/session/switch_version.rs +0 -109
- package/dist-engine-src/src/sql2/classify.rs +0 -182
- package/dist-engine-src/src/sql2/entity_provider.rs +0 -3211
- package/dist-engine-src/src/sql2/execute.rs +0 -3440
- package/dist-engine-src/src/sql2/public_bind/assignment.rs +0 -46
- package/dist-engine-src/src/sql2/public_bind/capability.rs +0 -41
- package/dist-engine-src/src/sql2/public_bind/dml.rs +0 -166
- package/dist-engine-src/src/sql2/public_bind/mod.rs +0 -25
- package/dist-engine-src/src/sql2/public_bind/table.rs +0 -168
- package/dist-engine-src/src/sql2/version_scope.rs +0 -394
- package/dist-engine-src/src/storage/types.rs +0 -501
- package/dist-engine-src/src/tracked_state/by_file_index.rs +0 -98
- package/dist-engine-src/src/tracked_state/materializer.rs +0 -488
- package/dist-engine-src/src/transaction/live_state_overlay.rs +0 -35
- package/dist-engine-src/src/version/lifecycle.rs +0 -221
- package/dist-engine-src/src/version/mod.rs +0 -13
- package/dist-engine-src/src/version/refs.rs +0 -330
- package/dist-engine-src/src/version/stage_rows.rs +0 -67
- package/dist-engine-src/src/version/types.rs +0 -21
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
use crate::entity_identity::EntityIdentity;
|
|
2
|
-
use crate::json_store::JsonRef;
|
|
3
|
-
|
|
4
|
-
/// Physical append/locality unit for commit metadata and derived commit SQL
|
|
5
|
-
/// surfaces.
|
|
6
|
-
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
|
7
|
-
pub(crate) struct Commit {
|
|
8
|
-
pub(crate) id: String,
|
|
9
|
-
pub(crate) change_id: String,
|
|
10
|
-
pub(crate) parent_ids: Vec<String>,
|
|
11
|
-
pub(crate) author_account_ids: Vec<String>,
|
|
12
|
-
pub(crate) created_at: String,
|
|
13
|
-
pub(crate) change_pack_count: u32,
|
|
14
|
-
pub(crate) membership_pack_count: u32,
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
impl Commit {
|
|
18
|
-
pub(crate) fn as_ref(&self) -> StoredCommitRef<'_> {
|
|
19
|
-
StoredCommitRef {
|
|
20
|
-
id: &self.id,
|
|
21
|
-
change_id: &self.change_id,
|
|
22
|
-
parent_ids: &self.parent_ids,
|
|
23
|
-
author_account_ids: &self.author_account_ids,
|
|
24
|
-
created_at: &self.created_at,
|
|
25
|
-
change_pack_count: self.change_pack_count,
|
|
26
|
-
membership_pack_count: self.membership_pack_count,
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/// Zero-copy view of stored [`Commit`] bytes.
|
|
32
|
-
#[derive(Debug, Clone, Copy)]
|
|
33
|
-
pub(crate) struct StoredCommitRef<'a> {
|
|
34
|
-
pub(crate) id: &'a str,
|
|
35
|
-
pub(crate) change_id: &'a str,
|
|
36
|
-
pub(crate) parent_ids: &'a [String],
|
|
37
|
-
pub(crate) author_account_ids: &'a [String],
|
|
38
|
-
pub(crate) created_at: &'a str,
|
|
39
|
-
pub(crate) change_pack_count: u32,
|
|
40
|
-
pub(crate) membership_pack_count: u32,
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/// Zero-copy view of a logical commit supplied before physical packing.
|
|
44
|
-
#[derive(Debug, Clone, Copy)]
|
|
45
|
-
pub(crate) struct CommitDraftRef<'a> {
|
|
46
|
-
pub(crate) id: &'a str,
|
|
47
|
-
pub(crate) change_id: &'a str,
|
|
48
|
-
pub(crate) parent_ids: &'a [String],
|
|
49
|
-
pub(crate) author_account_ids: &'a [String],
|
|
50
|
-
pub(crate) created_at: &'a str,
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/// Logical entity mutation fact stored in a commit change pack.
|
|
54
|
-
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
|
55
|
-
pub(crate) struct Change {
|
|
56
|
-
pub(crate) id: String,
|
|
57
|
-
pub(crate) entity_id: EntityIdentity,
|
|
58
|
-
pub(crate) schema_key: String,
|
|
59
|
-
pub(crate) file_id: Option<String>,
|
|
60
|
-
pub(crate) snapshot_ref: Option<JsonRef>,
|
|
61
|
-
pub(crate) metadata_ref: Option<JsonRef>,
|
|
62
|
-
pub(crate) created_at: String,
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/// Read-boundary view of a commit-store change with JSON refs resolved.
|
|
66
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
67
|
-
pub(crate) struct MaterializedChange {
|
|
68
|
-
pub(crate) id: String,
|
|
69
|
-
pub(crate) entity_id: EntityIdentity,
|
|
70
|
-
pub(crate) schema_key: String,
|
|
71
|
-
pub(crate) file_id: Option<String>,
|
|
72
|
-
pub(crate) snapshot_content: Option<String>,
|
|
73
|
-
pub(crate) metadata: Option<String>,
|
|
74
|
-
pub(crate) created_at: String,
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/// Commit-store change plus the physical pack that owns its JSON payloads.
|
|
78
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
79
|
-
pub(crate) struct LocatedChange {
|
|
80
|
-
pub(crate) record: Change,
|
|
81
|
-
pub(crate) source_commit_id: String,
|
|
82
|
-
pub(crate) source_pack_id: u32,
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
impl Change {
|
|
86
|
-
pub(crate) fn as_ref(&self) -> ChangeRef<'_> {
|
|
87
|
-
ChangeRef {
|
|
88
|
-
id: &self.id,
|
|
89
|
-
entity_id: &self.entity_id,
|
|
90
|
-
schema_key: &self.schema_key,
|
|
91
|
-
file_id: self.file_id.as_deref(),
|
|
92
|
-
snapshot_ref: self.snapshot_ref.as_ref(),
|
|
93
|
-
metadata_ref: self.metadata_ref.as_ref(),
|
|
94
|
-
created_at: &self.created_at,
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/// Zero-copy view of [`Change`].
|
|
100
|
-
#[derive(Debug, Clone, Copy)]
|
|
101
|
-
pub(crate) struct ChangeRef<'a> {
|
|
102
|
-
pub(crate) id: &'a str,
|
|
103
|
-
pub(crate) entity_id: &'a EntityIdentity,
|
|
104
|
-
pub(crate) schema_key: &'a str,
|
|
105
|
-
pub(crate) file_id: Option<&'a str>,
|
|
106
|
-
pub(crate) snapshot_ref: Option<&'a JsonRef>,
|
|
107
|
-
pub(crate) metadata_ref: Option<&'a JsonRef>,
|
|
108
|
-
pub(crate) created_at: &'a str,
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/// Logical scan request for the `lix_change` SQL surface over commit_store.
|
|
112
|
-
#[derive(Debug, Clone, Default)]
|
|
113
|
-
pub(crate) struct ChangeScanRequest {
|
|
114
|
-
pub(crate) limit: Option<usize>,
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/// Commit-local physical pack of newly authored change payloads.
|
|
118
|
-
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
|
119
|
-
pub(crate) struct ChangePack {
|
|
120
|
-
pub(crate) commit_id: String,
|
|
121
|
-
pub(crate) pack_id: u32,
|
|
122
|
-
pub(crate) changes: Vec<Change>,
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
impl ChangePack {
|
|
126
|
-
pub(crate) fn as_view(&self) -> ChangePackView<'_> {
|
|
127
|
-
ChangePackView {
|
|
128
|
-
commit_id: &self.commit_id,
|
|
129
|
-
pack_id: self.pack_id,
|
|
130
|
-
changes: &self.changes,
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/// Zero-copy view for a decoded [`ChangePack`].
|
|
136
|
-
#[derive(Debug, Clone, Copy)]
|
|
137
|
-
pub(crate) struct ChangePackView<'a> {
|
|
138
|
-
pub(crate) commit_id: &'a str,
|
|
139
|
-
pub(crate) pack_id: u32,
|
|
140
|
-
pub(crate) changes: &'a [Change],
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/// Storage location of an existing change payload.
|
|
144
|
-
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
|
145
|
-
pub(crate) struct ChangeLocator {
|
|
146
|
-
pub(crate) source_commit_id: String,
|
|
147
|
-
pub(crate) source_pack_id: u32,
|
|
148
|
-
pub(crate) source_ordinal: u32,
|
|
149
|
-
pub(crate) change_id: String,
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
impl ChangeLocator {
|
|
153
|
-
pub(crate) fn as_ref(&self) -> ChangeLocatorRef<'_> {
|
|
154
|
-
ChangeLocatorRef {
|
|
155
|
-
source_commit_id: &self.source_commit_id,
|
|
156
|
-
source_pack_id: self.source_pack_id,
|
|
157
|
-
source_ordinal: self.source_ordinal,
|
|
158
|
-
change_id: &self.change_id,
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/// Zero-copy view of [`ChangeLocator`].
|
|
164
|
-
#[derive(Debug, Clone, Copy)]
|
|
165
|
-
pub(crate) struct ChangeLocatorRef<'a> {
|
|
166
|
-
pub(crate) source_commit_id: &'a str,
|
|
167
|
-
pub(crate) source_pack_id: u32,
|
|
168
|
-
pub(crate) source_ordinal: u32,
|
|
169
|
-
pub(crate) change_id: &'a str,
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/// Exact lookup entry for a derived-surface-visible change id.
|
|
173
|
-
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
|
174
|
-
pub(crate) enum ChangeIndexEntry {
|
|
175
|
-
CommitHeader {
|
|
176
|
-
commit_id: String,
|
|
177
|
-
change_id: String,
|
|
178
|
-
},
|
|
179
|
-
PackedChange {
|
|
180
|
-
locator: ChangeLocator,
|
|
181
|
-
},
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
/// Commit-local physical pack of adopted/shared membership locators.
|
|
185
|
-
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
|
186
|
-
pub(crate) struct MembershipPack {
|
|
187
|
-
pub(crate) commit_id: String,
|
|
188
|
-
pub(crate) pack_id: u32,
|
|
189
|
-
pub(crate) members: Vec<ChangeLocator>,
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
impl MembershipPack {
|
|
193
|
-
pub(crate) fn as_view(&self) -> MembershipPackView<'_> {
|
|
194
|
-
MembershipPackView {
|
|
195
|
-
commit_id: &self.commit_id,
|
|
196
|
-
pack_id: self.pack_id,
|
|
197
|
-
members: &self.members,
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
/// Zero-copy view for a decoded [`MembershipPack`].
|
|
203
|
-
#[derive(Debug, Clone, Copy)]
|
|
204
|
-
pub(crate) struct MembershipPackView<'a> {
|
|
205
|
-
pub(crate) commit_id: &'a str,
|
|
206
|
-
pub(crate) pack_id: u32,
|
|
207
|
-
pub(crate) members: &'a [ChangeLocator],
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/// Locators produced while staging a commit.
|
|
211
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
212
|
-
pub(crate) struct StagedCommitStoreCommit {
|
|
213
|
-
pub(crate) authored_locators: Vec<ChangeLocator>,
|
|
214
|
-
pub(crate) adopted_locators: Vec<ChangeLocator>,
|
|
215
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"x-lix-key": "lix_version_descriptor",
|
|
3
|
-
"description": "User-facing version metadata (name and visibility) for a branch-like version. The stable identity of a version; the matching `lix_version_ref` carries the moving head pointer. The catalog's `lix_version` surface joins this descriptor with its ref to present a single user-visible version row.",
|
|
4
|
-
"x-lix-primary-key": [
|
|
5
|
-
"/id"
|
|
6
|
-
],
|
|
7
|
-
"x-lix-unique": [
|
|
8
|
-
[
|
|
9
|
-
"/name"
|
|
10
|
-
]
|
|
11
|
-
],
|
|
12
|
-
"type": "object",
|
|
13
|
-
"properties": {
|
|
14
|
-
"id": {
|
|
15
|
-
"type": "string",
|
|
16
|
-
"x-lix-default": "lix_uuid_v7()",
|
|
17
|
-
"description": "Stable version identifier (UUIDv7). Referenced by `lix_version_ref.id`."
|
|
18
|
-
},
|
|
19
|
-
"name": {
|
|
20
|
-
"type": "string",
|
|
21
|
-
"description": "Human-readable version name (e.g. `main`, `feature-x`) shown in version listings and CLI output."
|
|
22
|
-
},
|
|
23
|
-
"hidden": {
|
|
24
|
-
"type": "boolean",
|
|
25
|
-
"default": false,
|
|
26
|
-
"description": "When true, the version is filtered from default listings (CLI, catalog views); operations by explicit id still succeed."
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
"required": [
|
|
30
|
-
"id",
|
|
31
|
-
"name"
|
|
32
|
-
],
|
|
33
|
-
"additionalProperties": false
|
|
34
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"x-lix-key": "lix_version_ref",
|
|
3
|
-
"description": "Version head pointer. Records which commit a version should currently resolve to in the local runtime. Intentionally not part of canonical commit membership: refs may be reset client-side after sync without introducing content conflicts. Each `lix_version_descriptor.id` has exactly one `lix_version_ref` row.",
|
|
4
|
-
"x-lix-primary-key": [
|
|
5
|
-
"/id"
|
|
6
|
-
],
|
|
7
|
-
"x-lix-foreign-keys": [
|
|
8
|
-
{
|
|
9
|
-
"properties": [
|
|
10
|
-
"/id"
|
|
11
|
-
],
|
|
12
|
-
"references": {
|
|
13
|
-
"schemaKey": "lix_version_descriptor",
|
|
14
|
-
"properties": [
|
|
15
|
-
"/id"
|
|
16
|
-
]
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"properties": [
|
|
21
|
-
"/commit_id"
|
|
22
|
-
],
|
|
23
|
-
"references": {
|
|
24
|
-
"schemaKey": "lix_commit",
|
|
25
|
-
"properties": [
|
|
26
|
-
"/id"
|
|
27
|
-
]
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
],
|
|
31
|
-
"type": "object",
|
|
32
|
-
"properties": {
|
|
33
|
-
"id": {
|
|
34
|
-
"type": "string",
|
|
35
|
-
"x-lix-default": "lix_uuid_v7()",
|
|
36
|
-
"description": "Version identifier whose head pointer is being stored; matches `lix_version_descriptor.id`."
|
|
37
|
-
},
|
|
38
|
-
"commit_id": {
|
|
39
|
-
"type": "string",
|
|
40
|
-
"description": "Commit the version should currently resolve to in the local runtime (references `lix_commit.id`)."
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
"required": [
|
|
44
|
-
"id",
|
|
45
|
-
"commit_id"
|
|
46
|
-
],
|
|
47
|
-
"additionalProperties": false
|
|
48
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
use crate::transaction::types::{TransactionWrite, TransactionWriteMode};
|
|
2
|
-
use crate::version::{
|
|
3
|
-
version_descriptor_stage_row, version_ref_stage_row, VersionLifecycle, VersionOperation,
|
|
4
|
-
VersionReferenceRole,
|
|
5
|
-
};
|
|
6
|
-
use crate::LixError;
|
|
7
|
-
|
|
8
|
-
use super::context::SessionContext;
|
|
9
|
-
|
|
10
|
-
/// Options for creating a new version from the session's active version.
|
|
11
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
12
|
-
pub struct CreateVersionOptions {
|
|
13
|
-
/// Optional caller-provided version id. If omitted, engine generates one.
|
|
14
|
-
pub id: Option<String>,
|
|
15
|
-
/// User-facing version name.
|
|
16
|
-
pub name: String,
|
|
17
|
-
/// Optional commit id for the new version head. If omitted, the current
|
|
18
|
-
/// active version head is used.
|
|
19
|
-
pub from_commit_id: Option<String>,
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/// Receipt returned after creating a version.
|
|
23
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
24
|
-
pub struct CreateVersionReceipt {
|
|
25
|
-
pub id: String,
|
|
26
|
-
pub name: String,
|
|
27
|
-
pub hidden: bool,
|
|
28
|
-
pub commit_id: String,
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
impl SessionContext {
|
|
32
|
-
/// Creates a new version from this session's current version head.
|
|
33
|
-
///
|
|
34
|
-
/// Version descriptors are tracked global facts so every version agrees on
|
|
35
|
-
/// which versions exist. Version refs are untracked global moving pointers,
|
|
36
|
-
/// so creating a ref does not add another changelog fact.
|
|
37
|
-
pub async fn create_version(
|
|
38
|
-
&self,
|
|
39
|
-
options: CreateVersionOptions,
|
|
40
|
-
) -> Result<CreateVersionReceipt, LixError> {
|
|
41
|
-
self.with_write_transaction(|transaction| {
|
|
42
|
-
Box::pin(async move {
|
|
43
|
-
let version_id = options
|
|
44
|
-
.id
|
|
45
|
-
.unwrap_or_else(|| transaction.functions().call_uuid_v7());
|
|
46
|
-
let source_head = if let Some(from_commit_id) = options.from_commit_id {
|
|
47
|
-
let mut commit_graph = transaction.commit_graph_reader();
|
|
48
|
-
VersionLifecycle::require_existing_commit(
|
|
49
|
-
&mut commit_graph,
|
|
50
|
-
&from_commit_id,
|
|
51
|
-
VersionOperation::CreateVersion,
|
|
52
|
-
VersionReferenceRole::CommitSource,
|
|
53
|
-
)
|
|
54
|
-
.await?;
|
|
55
|
-
from_commit_id
|
|
56
|
-
} else {
|
|
57
|
-
let active_version_id = transaction.active_version_id().to_string();
|
|
58
|
-
let reader = transaction.version_ref_reader();
|
|
59
|
-
VersionLifecycle::new(&reader)
|
|
60
|
-
.require_existing_commit_id(
|
|
61
|
-
&active_version_id,
|
|
62
|
-
VersionOperation::CreateVersion,
|
|
63
|
-
VersionReferenceRole::Source,
|
|
64
|
-
)
|
|
65
|
-
.await?
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
transaction
|
|
69
|
-
.stage_write(TransactionWrite::Rows {
|
|
70
|
-
mode: TransactionWriteMode::Insert,
|
|
71
|
-
rows: vec![
|
|
72
|
-
version_descriptor_stage_row(&version_id, &options.name, false),
|
|
73
|
-
version_ref_stage_row(&version_id, &source_head),
|
|
74
|
-
],
|
|
75
|
-
})
|
|
76
|
-
.await?;
|
|
77
|
-
|
|
78
|
-
Ok(CreateVersionReceipt {
|
|
79
|
-
id: version_id,
|
|
80
|
-
name: options.name,
|
|
81
|
-
hidden: false,
|
|
82
|
-
commit_id: source_head,
|
|
83
|
-
})
|
|
84
|
-
})
|
|
85
|
-
})
|
|
86
|
-
.await
|
|
87
|
-
}
|
|
88
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
use crate::tracked_state::TrackedStateMergePlan;
|
|
2
|
-
use crate::transaction::types::TransactionAdoptedChange;
|
|
3
|
-
|
|
4
|
-
pub(crate) fn adopted_changes_from_merge_plan(
|
|
5
|
-
plan: &TrackedStateMergePlan,
|
|
6
|
-
target_version_id: &str,
|
|
7
|
-
) -> Vec<TransactionAdoptedChange> {
|
|
8
|
-
plan.patches
|
|
9
|
-
.iter()
|
|
10
|
-
.map(|patch| stage_adopted_change_from_patch(patch, target_version_id))
|
|
11
|
-
.collect()
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
fn stage_adopted_change_from_patch(
|
|
15
|
-
patch: &crate::tracked_state::TrackedStateMergePatch,
|
|
16
|
-
target_version_id: &str,
|
|
17
|
-
) -> TransactionAdoptedChange {
|
|
18
|
-
TransactionAdoptedChange {
|
|
19
|
-
version_id: target_version_id.to_string(),
|
|
20
|
-
change_id: patch.change_id().to_string(),
|
|
21
|
-
projected_row: patch.projected_row().clone(),
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
use crate::functions::FunctionContext;
|
|
2
|
-
use crate::session::context::{SessionContext, SessionSqlExecutionContext};
|
|
3
|
-
use crate::sql2::{self, SqlLogicalPlan};
|
|
4
|
-
use crate::storage::StorageReadScope;
|
|
5
|
-
use crate::transaction::open_transaction;
|
|
6
|
-
use crate::{LixError, SqlQueryResult, Value};
|
|
7
|
-
|
|
8
|
-
/// Opaque read plan used by the Optimization 9 SQL2 diagnostic benchmark.
|
|
9
|
-
///
|
|
10
|
-
/// This module is gated behind `storage-benches` and exists only to split SQL2
|
|
11
|
-
/// planning cost from SQL2 execution cost without widening the normal session
|
|
12
|
-
/// API.
|
|
13
|
-
pub struct PreparedReadPlan {
|
|
14
|
-
plan: SqlLogicalPlan,
|
|
15
|
-
read_scope:
|
|
16
|
-
StorageReadScope<Box<dyn crate::storage::StorageReadTransaction + Send + Sync + 'static>>,
|
|
17
|
-
runtime_functions: FunctionContext,
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
pub async fn plan_read_only(session: &SessionContext, sql: &str) -> Result<(), LixError> {
|
|
21
|
-
let prepared = prepare_read_plan(session, sql).await?;
|
|
22
|
-
drop(prepared.plan);
|
|
23
|
-
drop(prepared.runtime_functions);
|
|
24
|
-
prepared.read_scope.rollback().await
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
pub async fn plan_write_only(session: &SessionContext, sql: &str) -> Result<(), LixError> {
|
|
28
|
-
session.ensure_open()?;
|
|
29
|
-
let opened = open_transaction(
|
|
30
|
-
&session.mode,
|
|
31
|
-
session.storage.clone(),
|
|
32
|
-
std::sync::Arc::clone(&session.live_state),
|
|
33
|
-
std::sync::Arc::clone(&session.tracked_state),
|
|
34
|
-
std::sync::Arc::clone(&session.binary_cas),
|
|
35
|
-
std::sync::Arc::clone(&session.commit_store),
|
|
36
|
-
std::sync::Arc::clone(&session.version_ctx),
|
|
37
|
-
std::sync::Arc::clone(&session.catalog_context),
|
|
38
|
-
)
|
|
39
|
-
.await?;
|
|
40
|
-
let mut transaction = opened.transaction;
|
|
41
|
-
let runtime_functions = opened.runtime_functions;
|
|
42
|
-
let plan = sql2::create_write_logical_plan(&mut transaction, sql).await?;
|
|
43
|
-
drop(plan);
|
|
44
|
-
drop(runtime_functions);
|
|
45
|
-
transaction.rollback().await
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
pub async fn prepare_read_plan(
|
|
49
|
-
session: &SessionContext,
|
|
50
|
-
sql: &str,
|
|
51
|
-
) -> Result<PreparedReadPlan, LixError> {
|
|
52
|
-
session.ensure_open()?;
|
|
53
|
-
let read_scope = StorageReadScope::new(session.storage.begin_read_transaction().await?);
|
|
54
|
-
let mut read_store = read_scope.store();
|
|
55
|
-
let live_state: std::sync::Arc<dyn crate::live_state::LiveStateReader> =
|
|
56
|
-
std::sync::Arc::new(session.live_state.reader(read_store.clone()));
|
|
57
|
-
let runtime_functions = FunctionContext::prepare(live_state.as_ref()).await?;
|
|
58
|
-
let functions = runtime_functions.provider();
|
|
59
|
-
let active_version_id = session
|
|
60
|
-
.active_version_id_from_reader(&mut read_store)
|
|
61
|
-
.await?;
|
|
62
|
-
let visible_schemas = session
|
|
63
|
-
.catalog_context
|
|
64
|
-
.schema_jsons_for_sql_read_planning(live_state.as_ref(), &active_version_id)
|
|
65
|
-
.await?;
|
|
66
|
-
let ctx = SessionSqlExecutionContext {
|
|
67
|
-
active_version_id: &active_version_id,
|
|
68
|
-
read_store,
|
|
69
|
-
live_state: std::sync::Arc::clone(&session.live_state),
|
|
70
|
-
binary_cas: std::sync::Arc::clone(&session.binary_cas),
|
|
71
|
-
commit_store: std::sync::Arc::clone(&session.commit_store),
|
|
72
|
-
version_ctx: std::sync::Arc::clone(&session.version_ctx),
|
|
73
|
-
visible_schemas,
|
|
74
|
-
functions: functions.clone(),
|
|
75
|
-
};
|
|
76
|
-
let plan = sql2::create_logical_plan(&ctx, sql).await?;
|
|
77
|
-
drop(ctx);
|
|
78
|
-
drop(live_state);
|
|
79
|
-
|
|
80
|
-
Ok(PreparedReadPlan {
|
|
81
|
-
plan,
|
|
82
|
-
read_scope,
|
|
83
|
-
runtime_functions,
|
|
84
|
-
})
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
pub async fn execute_read_plan(
|
|
88
|
-
prepared: PreparedReadPlan,
|
|
89
|
-
params: &[Value],
|
|
90
|
-
) -> Result<SqlQueryResult, LixError> {
|
|
91
|
-
let PreparedReadPlan {
|
|
92
|
-
plan,
|
|
93
|
-
read_scope,
|
|
94
|
-
runtime_functions,
|
|
95
|
-
} = prepared;
|
|
96
|
-
let result = sql2::execute_logical_plan(plan, params).await;
|
|
97
|
-
read_scope.rollback().await?;
|
|
98
|
-
drop(runtime_functions);
|
|
99
|
-
result
|
|
100
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
use std::sync::Arc;
|
|
2
|
-
|
|
3
|
-
use serde_json::json;
|
|
4
|
-
|
|
5
|
-
use crate::transaction::types::{TransactionJson, TransactionWriteRow};
|
|
6
|
-
use crate::version::{VersionLifecycle, VersionOperation, VersionReferenceRole};
|
|
7
|
-
use crate::LixError;
|
|
8
|
-
use crate::GLOBAL_VERSION_ID;
|
|
9
|
-
|
|
10
|
-
use super::context::{SessionContext, SessionMode, WORKSPACE_VERSION_KEY};
|
|
11
|
-
|
|
12
|
-
const KEY_VALUE_SCHEMA_KEY: &str = "lix_key_value";
|
|
13
|
-
|
|
14
|
-
/// Options for switching a session to another version.
|
|
15
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
16
|
-
pub struct SwitchVersionOptions {
|
|
17
|
-
pub version_id: String,
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/// Receipt returned after switching to another version.
|
|
21
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
22
|
-
pub struct SwitchVersionReceipt {
|
|
23
|
-
pub version_id: String,
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
impl SessionContext {
|
|
27
|
-
/// Switches the session's active version selector.
|
|
28
|
-
///
|
|
29
|
-
/// Pinned sessions switch in memory and return a new pinned session.
|
|
30
|
-
/// Workspace sessions update the shared workspace selector so other
|
|
31
|
-
/// workspace sessions observe the new active version on their next use.
|
|
32
|
-
pub async fn switch_version(
|
|
33
|
-
&self,
|
|
34
|
-
options: SwitchVersionOptions,
|
|
35
|
-
) -> Result<(SessionContext, SwitchVersionReceipt), LixError> {
|
|
36
|
-
let version_id = options.version_id;
|
|
37
|
-
let receipt_version_id = version_id.clone();
|
|
38
|
-
let current_mode = self.mode.clone();
|
|
39
|
-
let next_mode = self
|
|
40
|
-
.with_write_transaction(|transaction| {
|
|
41
|
-
Box::pin(async move {
|
|
42
|
-
{
|
|
43
|
-
let reader = transaction.version_ref_reader();
|
|
44
|
-
VersionLifecycle::new(&reader)
|
|
45
|
-
.require_existing_commit_id(
|
|
46
|
-
&version_id,
|
|
47
|
-
VersionOperation::SwitchVersion,
|
|
48
|
-
VersionReferenceRole::Target,
|
|
49
|
-
)
|
|
50
|
-
.await?
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
match current_mode {
|
|
54
|
-
SessionMode::Pinned { .. } => Ok(SessionMode::Pinned {
|
|
55
|
-
version_id: version_id.clone(),
|
|
56
|
-
}),
|
|
57
|
-
SessionMode::Workspace => {
|
|
58
|
-
transaction
|
|
59
|
-
.stage_rows(vec![workspace_version_stage_row(&version_id)?])
|
|
60
|
-
.await?;
|
|
61
|
-
Ok(SessionMode::Workspace)
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
})
|
|
65
|
-
})
|
|
66
|
-
.await?;
|
|
67
|
-
|
|
68
|
-
let session = SessionContext::new_with_closed(
|
|
69
|
-
next_mode,
|
|
70
|
-
self.storage.clone(),
|
|
71
|
-
Arc::clone(&self.live_state),
|
|
72
|
-
Arc::clone(&self.tracked_state),
|
|
73
|
-
Arc::clone(&self.binary_cas),
|
|
74
|
-
Arc::clone(&self.commit_store),
|
|
75
|
-
Arc::clone(&self.version_ctx),
|
|
76
|
-
Arc::clone(&self.catalog_context),
|
|
77
|
-
self.closed_flag(),
|
|
78
|
-
);
|
|
79
|
-
Ok((
|
|
80
|
-
session,
|
|
81
|
-
SwitchVersionReceipt {
|
|
82
|
-
version_id: receipt_version_id,
|
|
83
|
-
},
|
|
84
|
-
))
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
fn workspace_version_stage_row(version_id: &str) -> Result<TransactionWriteRow, LixError> {
|
|
89
|
-
Ok(TransactionWriteRow {
|
|
90
|
-
entity_id: Some(crate::entity_identity::EntityIdentity::single(
|
|
91
|
-
WORKSPACE_VERSION_KEY,
|
|
92
|
-
)),
|
|
93
|
-
schema_key: KEY_VALUE_SCHEMA_KEY.to_string(),
|
|
94
|
-
file_id: None,
|
|
95
|
-
snapshot: Some(TransactionJson::from_value_unchecked(json!({
|
|
96
|
-
"key": WORKSPACE_VERSION_KEY,
|
|
97
|
-
"value": version_id,
|
|
98
|
-
}))),
|
|
99
|
-
metadata: None,
|
|
100
|
-
origin: None,
|
|
101
|
-
created_at: None,
|
|
102
|
-
updated_at: None,
|
|
103
|
-
global: true,
|
|
104
|
-
change_id: None,
|
|
105
|
-
commit_id: None,
|
|
106
|
-
untracked: true,
|
|
107
|
-
version_id: GLOBAL_VERSION_ID.to_string(),
|
|
108
|
-
})
|
|
109
|
-
}
|