Skip to content

Commit 1304595

Browse files
authored
Change chasm.ReadComponent, PollComponent, and UpdateComponent to take an any (#8578)
## What changed? In title. ## Why? Components are accessed via various interfaces and we do not expect all of those interfaces to embed `Component`.
1 parent 19ac338 commit 1304595

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

chasm/engine.go

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ func UpdateWithNewEntity[C Component, I any, O1 any, O2 any](
176176
// - consider remove ComponentRef from the return value and allow components to get
177177
// the ref in the transition function. There are some caveats there, check the
178178
// comment of the NewRef method in MutableContext.
179-
func UpdateComponent[C Component, R []byte | ComponentRef, I any, O any](
179+
func UpdateComponent[C any, R []byte | ComponentRef, I any, O any](
180180
ctx context.Context,
181181
r R,
182182
updateFn func(C, MutableContext, I) (O, error),
@@ -207,7 +207,7 @@ func UpdateComponent[C Component, R []byte | ComponentRef, I any, O any](
207207
return output, newSerializedRef, err
208208
}
209209

210-
func ReadComponent[C Component, R []byte | ComponentRef, I any, O any](
210+
func ReadComponent[C any, R []byte | ComponentRef, I any, O any](
211211
ctx context.Context,
212212
r R,
213213
readFn func(C, Context, I) (O, error),
@@ -234,14 +234,7 @@ func ReadComponent[C Component, R []byte | ComponentRef, I any, O any](
234234
return output, err
235235
}
236236

237-
type PollComponentRequest[C Component, I any, O any] struct {
238-
Ref ComponentRef
239-
PredicateFn func(C, Context, I) bool
240-
OperationFn func(C, MutableContext, I) (O, error)
241-
Input I
242-
}
243-
244-
func PollComponent[C Component, R []byte | ComponentRef, I any, O any, T any](
237+
func PollComponent[C any, R []byte | ComponentRef, I any, O any, T any](
245238
ctx context.Context,
246239
r R,
247240
predicateFn func(C, Context, I) (T, bool, error),

chasm/nexus_completion.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ const (
1717
// NexusCompletionHandler is implemented by CHASM components that want to handle
1818
// Nexus operation completion callbacks.
1919
type NexusCompletionHandler interface {
20-
Component
2120
HandleNexusCompletion(ctx MutableContext, completion *persistencespb.ChasmNexusCompletion) error
2221
}
2322

0 commit comments

Comments
 (0)