Browse Source

Add better docs for Group

pull/1842/head
Jae Kwon 8 years ago
parent
commit
d741b81ab5
2 changed files with 26 additions and 2 deletions
  1. +22
    -2
      group.go
  2. +4
    -0
      group_test.go

+ 22
- 2
group.go View File

@ -19,8 +19,28 @@ You can open a Group to keep restrictions on an AutoFile, like
the maximum size of each chunk, and/or the total amount of bytes
stored in the group.
The Group can also be used to binary-search, and to read atomically
with respect to the Group's Head (the AutoFile being appended to)
The first file to be written in the Group.Dir is the head file.
Dir/
- <HeadPath>
Once the Head file reaches the size limit, it will be rotated.
Dir/
- <HeadPath>.000 // First rolled file
- <HeadPath> // New head path, starts empty.
// The implicit index is 001.
As more files are written, the index numbers grow...
Dir/
- <HeadPath>.000 // First rolled file
- <HeadPath>.001 // Second rolled file
- ...
- <HeadPath> // New head path
The Group can also be used to binary-search for some line,
assuming that marker lines are written occasionally.
*/
const groupCheckDuration = 1000 * time.Millisecond


+ 4
- 0
group_test.go View File

@ -230,6 +230,10 @@ func TestSearch(t *testing.T) {
if !strings.HasPrefix(line, "INFO 0 ") {
t.Error("Failed to fetch correct line, which is the earliest INFO")
}
err = gr.Close()
if err != nil {
t.Error("Failed to close GroupReader", err)
}
}
// Now search for something that is too large.


Loading…
Cancel
Save