You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/08/22 19:35:43 UTC

[GitHub] [beam] riteshghorse commented on a diff in pull request #22798: E2E basic state support

riteshghorse commented on code in PR #22798:
URL: https://github.com/apache/beam/pull/22798#discussion_r951833219


##########
sdks/go/pkg/beam/core/runtime/harness/statemgr.go:
##########
@@ -180,6 +236,62 @@ func newRunnerReader(ch *StateChannel, instID instructionID, k []byte) *stateKey
 	}
 }
 
+func newBagUserStateReader(ch *StateChannel, id exec.StreamID, instID instructionID, userStateID string, k []byte, w []byte) *stateKeyReader {
+	key := &fnpb.StateKey{
+		Type: &fnpb.StateKey_BagUserState_{
+			BagUserState: &fnpb.StateKey_BagUserState{
+				TransformId: id.PtransformID,
+				UserStateId: userStateID,
+				Window:      w,
+				Key:         k,
+			},
+		},
+	}
+	return &stateKeyReader{
+		instID: instID,
+		key:    key,
+		ch:     ch,
+	}
+}
+
+func newBagUserStateAppender(ch *StateChannel, id exec.StreamID, instID instructionID, userStateID string, k []byte, w []byte) *stateKeyWriter {
+	key := &fnpb.StateKey{
+		Type: &fnpb.StateKey_BagUserState_{
+			BagUserState: &fnpb.StateKey_BagUserState{
+				TransformId: id.PtransformID,
+				UserStateId: userStateID,
+				Window:      w,
+				Key:         k,
+			},
+		},
+	}
+	return &stateKeyWriter{
+		instID:    instID,
+		key:       key,
+		ch:        ch,
+		writeType: writeTypeAppend,
+	}
+}
+
+func newBagUserStateClearer(ch *StateChannel, id exec.StreamID, instID instructionID, userStateID string, k []byte, w []byte) *stateKeyWriter {

Review Comment:
   What do you think about combining the `newBagUserStateAppender` and `newBagUserStateClearer` with writeOption as an argument since both function are almost same?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org