Skip to content

Commit

Permalink
Merge pull request etcd-io#4084 from gyuho/revisioin_document
Browse files Browse the repository at this point in the history
storage: add/fix revision/generation description
  • Loading branch information
gyuho committed Dec 29, 2015
2 parents f3b3557 + 5284c1c commit c3655cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 3 additions & 2 deletions storage/key_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ var (
// {1.0, 2.0, 3.0(t)}
//
// Compact a keyIndex removes the versions with smaller or equal to
// rev except the largest one. If the generations becomes empty
// rev except the largest one. If the generation becomes empty
// during compaction, it will be removed. if all the generations get
// removed, the keyIndex Should be removed.
// removed, the keyIndex should be removed.

// For example:
// compact(2) on the previous example
Expand Down Expand Up @@ -294,6 +294,7 @@ func (ki *keyIndex) String() string {
return s
}

// generation contains multiple revisions of a key.
type generation struct {
ver int64
created revision // when the generation is created (put in first revision).
Expand Down
9 changes: 8 additions & 1 deletion storage/revision.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,16 @@ import "encoding/binary"
// is a '_'. The last 8 bytes is the revision.sub in big-endian format.
const revBytesLen = 8 + 1 + 8

// A revision indicates modification of the key-value space.
// The set of changes that share same main revision changes the key-value space atomically.
type revision struct {
// main is the main revision of a set of changes that happen atomically.
main int64
sub int64

// sub is the the sub revision of a change in a set of changes that happen
// atomically. Each change has different increasing sub revision in that
// set.
sub int64
}

func (a revision) GreaterThan(b revision) bool {
Expand Down

0 comments on commit c3655cb

Please sign in to comment.