forked from hyperledger/fabric
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dataformats.go
37 lines (29 loc) · 937 Bytes
/
dataformats.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package dataformat
import "fmt"
const (
// Version1x specifies the data format in version 1.x
Version1x = ""
// Version20 specifies the data format in version 2.0
Version20 = "2.0"
)
// ErrVersionMismatch is returned if it is detected that the version of the format recorded in
// the internal database is different from what is specified in the `Conf` that is used for opening the db
type ErrVersionMismatch struct {
DBInfo string
ExpectedVersion string
Version string
}
func (e *ErrVersionMismatch) Error() string {
return fmt.Sprintf("unexpected format. db info = [%s], data format = [%s], expected format = [%s]",
e.DBInfo, e.Version, e.ExpectedVersion,
)
}
// IsVersionMismatch returns true if err is an ErrVersionMismatch
func IsVersionMismatch(err error) bool {
_, ok := err.(*ErrVersionMismatch)
return ok
}