Skip to content

Commit

Permalink
internal: make appending to serialised indices invalid
Browse files Browse the repository at this point in the history
Updates #12.
  • Loading branch information
kortschak committed Sep 15, 2015
1 parent 2ce9f00 commit 8fc5212
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/index_read.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ func ReadIndex(r io.Reader, n int32, typ string) (Index, error) {
return idx, err
}
idx.IsSorted = true

// Set the index of the last record to max int to
// prevent addition of records out of order. This
// means that the only way to append to an index is
// to re-index and add to that created index.
// TODO(kortschak) See if index appending is feasible
// and needed.
idx.LastRecord = int(^uint(0) >> 1)

return idx, nil
}

Expand Down

0 comments on commit 8fc5212

Please sign in to comment.