From faecfac2fa90c14f8d4cd1d3a1b478dcc81df318 Mon Sep 17 00:00:00 2001 From: Shubheksha Jalan Date: Thu, 11 Jan 2018 14:06:49 +0530 Subject: [PATCH] update docs, rename docs folder, add error condition --- {Documentation => docs}/format/chunks.md | 0 {Documentation => docs}/format/index.md | 2 +- {Documentation => docs}/format/tombstones.md | 0 index/index.go | 8 ++++---- 4 files changed, 5 insertions(+), 5 deletions(-) rename {Documentation => docs}/format/chunks.md (100%) rename {Documentation => docs}/format/index.md (98%) rename {Documentation => docs}/format/tombstones.md (100%) diff --git a/Documentation/format/chunks.md b/docs/format/chunks.md similarity index 100% rename from Documentation/format/chunks.md rename to docs/format/chunks.md diff --git a/Documentation/format/index.md b/docs/format/index.md similarity index 98% rename from Documentation/format/index.md rename to docs/format/index.md index ce37999078..48366ef8dd 100644 --- a/Documentation/format/index.md +++ b/docs/format/index.md @@ -65,7 +65,7 @@ Strings are referenced by pointing to the beginning of their length field. The s ### Series The section contains a sequence of series that hold the label set of the series as well as its chunks within the block. The series are sorted lexicographically by their label sets. -The file offset to the beginning of a series serves as the series' ID in all subsequent references. Thereby, a sorted list of series IDs implies a lexicographically sorted list of series label sets. +Each series section is aligned to 16 bytes. The ID for a series is the `offset/16`. This serves as the series' ID in all subsequent references. Thereby, a sorted list of series IDs implies a lexicographically sorted list of series label sets. ``` ┌───────────────────────────────────────┐ diff --git a/Documentation/format/tombstones.md b/docs/format/tombstones.md similarity index 100% rename from Documentation/format/tombstones.md rename to docs/format/tombstones.md diff --git a/index/index.go b/index/index.go index f49b9236ec..98ddb8da80 100644 --- a/index/index.go +++ b/index/index.go @@ -575,12 +575,12 @@ func NewReader(b ByteSlice, version int) (*Reader, error) { return newReader(b, nil, version) } -func NewReaderV1(b ByteSlice, c io.Closer, version int) (*Reader, error) { - return newReader(b, c, version) -} - // NewFileReader returns a new index reader against the given index file. func NewFileReader(path string, version int) (*Reader, error) { + if version != 1 && version != 2 { + return nil, errors.Errorf("unexpected file version %d", version) + + } f, err := fileutil.OpenMmapFile(path) if err != nil { return nil, err