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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to