Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(514)

Unified Diff: common/iotools/countingreader.go

Issue 2435883002: LogDog: Fix archival Get/Tail implementations. (Closed)
Patch Set: LogDog: Fix archival Get/Tail implementations. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: common/iotools/countingreader.go
diff --git a/common/iotools/countingreader.go b/common/iotools/countingreader.go
index ec807e45403a6304be2793fc27c0d7f3e6c70787..8c0f1b1396516eb48fb2a4a7e2e560d03f48bfbe 100644
--- a/common/iotools/countingreader.go
+++ b/common/iotools/countingreader.go
@@ -12,7 +12,7 @@ import (
type CountingReader struct {
io.Reader // The underlying io.Reader.
- count int64
+ Count int64
dnj 2016/10/19 23:18:59 This is trivial enough that I don't mind combining
}
var _ io.Reader = (*CountingReader)(nil)
@@ -20,7 +20,7 @@ var _ io.Reader = (*CountingReader)(nil)
// Read implements io.Reader.
func (c *CountingReader) Read(buf []byte) (int, error) {
amount, err := c.Reader.Read(buf)
- c.count += int64(amount)
+ c.Count += int64(amount)
return amount, err
}
@@ -30,7 +30,7 @@ func (c *CountingReader) ReadByte() (byte, error) {
if br, ok := c.Reader.(io.ByteReader); ok {
b, err := br.ReadByte()
if err == nil {
- c.count++
+ c.Count++
}
return b, err
}
@@ -38,13 +38,8 @@ func (c *CountingReader) ReadByte() (byte, error) {
data := []byte{0}
amount, err := c.Reader.Read(data)
if amount != 0 {
- c.count += int64(amount)
+ c.Count += int64(amount)
return data[0], err
}
return 0, err
}
-
-// Count returns the number of bytes that have been read.
-func (c *CountingReader) Count() int64 {
- return c.count
-}
« no previous file with comments | « no previous file | common/iotools/countingreader_test.go » ('j') | logdog/appengine/coordinator/endpoints/logs/get.go » ('J')

Powered by Google App Engine
This is Rietveld 408576698