0
0

bump index format version number, start checking version on open

This commit is contained in:
Marty Schoch 2015-02-17 17:15:53 +05:30
parent 251e4717a2
commit c566d34264

View File

@ -27,7 +27,9 @@ import (
var VersionKey = []byte{'v'}
const Version uint8 = 1
const Version uint8 = 2
var IncompatibleVersion = fmt.Errorf("incompatible version, %d is supported", Version)
type UpsideDownCouch struct {
version uint8
@ -83,6 +85,19 @@ func (udc *UpsideDownCouch) loadSchema(kvreader store.KVReader) (err error) {
key, val, valid = it.Current()
}
keyPrefix = []byte{'v'}
val, err = kvreader.Get(keyPrefix)
if err != nil {
return err
}
vr, err := NewVersionRowKV(keyPrefix, val)
if err != nil {
return err
}
if vr.version != Version {
return IncompatibleVersion
}
return
}