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/06/27 14:49:35 UTC

[GitHub] [beam] jrmccluskey commented on a diff in pull request #21942: Go SDK: Update memory file system to return an io.ReadSeekCloser.

jrmccluskey commented on code in PR #21942:
URL: https://github.com/apache/beam/pull/21942#discussion_r907473286


##########
sdks/go/pkg/beam/io/filesystem/memfs/memory.go:
##########
@@ -156,9 +163,77 @@ type commitWriter struct {
 }
 
 func (w *commitWriter) Write(p []byte) (n int, err error) {
-	return w.buf.Write(p)
+	n, err = w.buf.Write(p)
+	if err != nil {
+		return n, err
+	}
+
+	w.instance.write(w.key, w.buf.Bytes())
+	return n, nil
 }
 
 func (w *commitWriter) Close() error {
-	return w.instance.write(w.key, w.buf.Bytes())
+	return nil
 }
+
+// bytesReader implements io.Reader, io.Seeker, io.Cloer for memfs "files."

Review Comment:
   ```suggestion
   // bytesReader implements io.Reader, io.Seeker, io.Closer for memfs "files."
   ```



-- 
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