diff --git a/group.go b/group.go index 84aa8a22..04403bb7 100644 --- a/group.go +++ b/group.go @@ -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/ + - + +Once the Head file reaches the size limit, it will be rotated. + + Dir/ + - .000 // First rolled file + - // New head path, starts empty. + // The implicit index is 001. + +As more files are written, the index numbers grow... + + Dir/ + - .000 // First rolled file + - .001 // Second rolled file + - ... + - // 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 diff --git a/group_test.go b/group_test.go index ced88c8b..f7c70b70 100644 --- a/group_test.go +++ b/group_test.go @@ -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.