Skip to content

Commit 24ef87c

Browse files
committed
Rename: ref.componentVT
1 parent e1a52d4 commit 24ef87c

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

chasm/component_state_token.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func HasStateAdvanced(c Component, ctx Context, stateToken []byte) ([]byte, bool
2525
return nil, false, err
2626
}
2727

28-
switch transitionhistory.Compare(token.VersionedTransition, ref.componentLastUpdateVT) {
28+
switch transitionhistory.Compare(token.VersionedTransition, ref.componentVT) {
2929
case -1:
3030
// State has advanced beyond stateToken
3131
return refBytes, true, nil
@@ -49,7 +49,7 @@ func EncodeComponentStateToken(refBytes []byte) ([]byte, error) {
4949
}
5050
return proto.Marshal(&activitypb.ComponentStateToken{
5151
Version: 1,
52-
VersionedTransition: ref.componentLastUpdateVT,
52+
VersionedTransition: ref.componentVT,
5353
})
5454
}
5555

chasm/ref.go

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ type ComponentRef struct {
3838
// entityLastUpdateVT is the consistency token for the entire entity.
3939
entityLastUpdateVT *persistencespb.VersionedTransition
4040

41-
// componentLastUpdateVT is the VT when this component was last updated.
42-
// This enables fine-grained change detection for polling specific components.
43-
componentLastUpdateVT *persistencespb.VersionedTransition
44-
4541
// componentType is the fully qualified component type name.
4642
// It is for performing partial loading more efficiently in future versions of CHASM.
4743
//
@@ -55,6 +51,7 @@ type ComponentRef struct {
5551

5652
// componentPath and componentInitialVT are used to identify a component.
5753
componentPath []string
54+
componentVT *persistencespb.VersionedTransition
5855
componentInitialVT *persistencespb.VersionedTransition
5956

6057
validationFn func(NodeBackend, Context, Component) error
@@ -128,7 +125,7 @@ func (r *ComponentRef) Serialize(
128125
EntityVersionedTransition: r.entityLastUpdateVT,
129126
ComponentPath: r.componentPath,
130127
ComponentInitialVersionedTransition: r.componentInitialVT,
131-
ComponentVersionedTransition: r.componentLastUpdateVT,
128+
ComponentVersionedTransition: r.componentVT,
132129
}
133130
return pRef.Marshal()
134131
}
@@ -154,10 +151,10 @@ func ProtoRefToComponentRef(pRef *persistencespb.ChasmComponentRef) ComponentRef
154151
BusinessID: pRef.BusinessId,
155152
EntityID: pRef.EntityId,
156153
},
157-
archetype: Archetype(pRef.Archetype),
158-
entityLastUpdateVT: pRef.EntityVersionedTransition,
159-
componentLastUpdateVT: pRef.ComponentVersionedTransition,
160-
componentPath: pRef.ComponentPath,
161-
componentInitialVT: pRef.ComponentInitialVersionedTransition,
154+
archetype: Archetype(pRef.Archetype),
155+
entityLastUpdateVT: pRef.EntityVersionedTransition,
156+
componentVT: pRef.ComponentVersionedTransition,
157+
componentPath: pRef.ComponentPath,
158+
componentInitialVT: pRef.ComponentInitialVersionedTransition,
162159
}
163160
}

chasm/tree.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1209,7 +1209,7 @@ func (n *Node) Ref(
12091209
entityLastUpdateVT: transitionhistory.CopyVersionedTransition(
12101210
node.backend.CurrentVersionedTransition(),
12111211
),
1212-
componentLastUpdateVT: transitionhistory.CopyVersionedTransition(
1212+
componentVT: transitionhistory.CopyVersionedTransition(
12131213
node.serializedNode.GetMetadata().GetLastUpdateVersionedTransition(),
12141214
),
12151215
componentPath: path,

0 commit comments

Comments
 (0)