From ac5bd71d8fa90c2045873e49505bae7d4bf83ec3 Mon Sep 17 00:00:00 2001 From: Fabian Reinartz Date: Fri, 10 Nov 2017 13:23:14 +0000 Subject: [PATCH] Doc fixes --- chunks.go | 4 ++-- index.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/chunks.go b/chunks.go index bab0a0bad..30ab93f80 100644 --- a/chunks.go +++ b/chunks.go @@ -322,11 +322,11 @@ func newChunkReader(bs []ByteSlice, cs []io.Closer, pool chunks.Pool) (*chunkRea } // NewChunkReader returns a new chunk reader against the given byte slices. -func NewChunkReader(bs []ByteSlice, pool chunks.Pool) ChunkReader { +func NewChunkReader(bs []ByteSlice, pool chunks.Pool) (ChunkReader, error) { if pool == nil { pool = chunks.NewPool() } - return &chunkReader{bs: bs, pool: pool} + return newChunkReader(bs, nil, pool) } // NewDirChunkReader returns a new ChunkReader against sequentially numbered files in the diff --git a/index.go b/index.go index 277807e21..6895c16f4 100644 --- a/index.go +++ b/index.go @@ -605,11 +605,12 @@ func (b realByteSlice) Sub(start, end int) ByteSlice { return b[start:end] } -// NewIndexReader returns a new IndexReader on the given directory. +// NewIndexReader returns a new IndexReader on the given byte slice. func NewIndexReader(b ByteSlice) (IndexReader, error) { return newIndexReader(b, nil) } +// NewFileIndexReader returns a new index reader against the given index file. func NewFileIndexReader(path string) (IndexReader, error) { f, err := openMmapFile(path) if err != nil { @@ -618,7 +619,6 @@ func NewFileIndexReader(path string) (IndexReader, error) { return newIndexReader(realByteSlice(f.b), f) } -// newIndexReader returns a new indexReader on the given directory. func newIndexReader(b ByteSlice, c io.Closer) (*indexReader, error) { r := &indexReader{ b: b, @@ -660,7 +660,7 @@ func (r *indexReader) readTOC() error { d := decbuf{b: b[:len(b)-4]} if d.crc32() != expCRC { - return (errInvalidChecksum) + return errInvalidChecksum } r.toc.symbols = d.be64() @@ -697,7 +697,7 @@ func (r *indexReader) decbufAt(off int) decbuf { return dec } -// decbufAt returns a new decoding buffer. It expects the first bytes +// decbufUvarintAt returns a new decoding buffer. It expects the first bytes // after offset to hold the uvarint-encoded buffers length, followed by the contents and the expected // checksum. func (r *indexReader) decbufUvarintAt(off int) decbuf {