Skip to content

Commit

Permalink
Bump etcd dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
wzshiming committed May 23, 2024
1 parent b2c0dc2 commit 43b391c
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 14 deletions.
3 changes: 2 additions & 1 deletion cmd/decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ import (
"strings"
"testing"

"github.com/coreos/etcd/mvcc/mvccpb"
"github.com/etcd-io/auger/pkg/encoding"

"go.etcd.io/etcd/api/v3/mvccpb"
)

var decodeTests = []struct {
Expand Down
3 changes: 2 additions & 1 deletion cmd/extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ import (
"strconv"
"strings"

"github.com/coreos/etcd/mvcc/mvccpb"
"github.com/etcd-io/auger/pkg/data"
"github.com/etcd-io/auger/pkg/encoding"
"github.com/etcd-io/auger/pkg/scheme"
"github.com/google/safetext/yamltemplate"
"github.com/spf13/cobra"

"go.etcd.io/etcd/api/v3/mvccpb"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ module github.com/etcd-io/auger
go 1.22.0

require (
github.com/coreos/bbolt v1.3.1-coreos.3
github.com/coreos/etcd v3.1.11+incompatible
github.com/google/safetext v0.0.0-20220914124124-e18e3fe012bf
github.com/spf13/cobra v1.8.0
go.etcd.io/bbolt v1.3.10
go.etcd.io/etcd/api/v3 v3.5.13
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.30.1
k8s.io/apimachinery v0.30.1
Expand Down
10 changes: 6 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
github.com/coreos/bbolt v1.3.1-coreos.3 h1:sP70znHBV8469pbVsmR2G6wvd2oQwgxtgWyZvV3KVBo=
github.com/coreos/bbolt v1.3.1-coreos.3/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.1.11+incompatible h1:8Zwb+fsI+3wXGp23Pjn1eEFE/3P5ib5yXVoAMRxFOgM=
github.com/coreos/etcd v3.1.11+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand Down Expand Up @@ -50,6 +46,10 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
go.etcd.io/bbolt v1.3.10 h1:+BqfJTcCzTItrop8mq/lbzL8wSGtj94UO/3U31shqG0=
go.etcd.io/bbolt v1.3.10/go.mod h1:bK3UQLPJZly7IlNmV7uVHJDxfe5aK9Ll93e/74Y9oEQ=
go.etcd.io/etcd/api/v3 v3.5.13 h1:8WXU2/NBge6AUF1K1gOexB6e07NgsN1hXK0rSTtgSp4=
go.etcd.io/etcd/api/v3 v3.5.13/go.mod h1:gBqlqkcMMZMVTMm4NDZloEVJzxQOQIls8splbqBDa0c=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
Expand All @@ -64,6 +64,8 @@ golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE=
golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand Down
19 changes: 13 additions & 6 deletions pkg/data/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ import (
"strings"
"text/template"

bolt "github.com/coreos/bbolt"
"github.com/coreos/etcd/mvcc/mvccpb"
"github.com/etcd-io/auger/pkg/encoding"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/serializer"

bolt "go.etcd.io/bbolt"
"go.etcd.io/etcd/api/v3/mvccpb"
)

// See etcd/mvcc/kvstore.go:keyBucketName
Expand Down Expand Up @@ -150,13 +151,19 @@ type Checksum struct {
CompactRevision int64
}

func boltOpen(path string) (*bolt.DB, error) {
return bolt.Open(path, 0400, &bolt.Options{
ReadOnly: true,
})
}

// HashByRevision returns the checksum and revision. The checksum is of the live keyspace at a
// particular revision. It is equivalent to performing a range request of all key-value pairs can
// computing a hash of the data. If revision is 0, the latest revision is checksumed, else revision
// is checksumed. The resulting hash is consistent particular revision in the presence of
// compactions; so long as the revions itself has not been compacted, the hash never changes.
func HashByRevision(filename string, revision int64) (Checksum, error) {
db, err := bolt.Open(filename, 0400, &bolt.Options{})
db, err := boltOpen(filename)
if err != nil {
return Checksum{}, err
}
Expand Down Expand Up @@ -203,7 +210,7 @@ func getCompactRevision(db *bolt.DB) (int64, error) {
// ListKeySummaries returns a result set with all the provided filters and projections applied.
func ListKeySummaries(codecs serializer.CodecFactory, filename string, filters []Filter, proj *KeySummaryProjection, revision int64) ([]*KeySummary, error) {
var err error
db, err := bolt.Open(filename, 0400, &bolt.Options{})
db, err := boltOpen(filename)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -304,7 +311,7 @@ func sortKeySummaries(m map[string]*KeySummary) []*KeySummary {

// ListVersions lists all versions of a object with the given key.
func ListVersions(filename string, key string) ([]int64, error) {
db, err := bolt.Open(filename, 0400, &bolt.Options{})
db, err := boltOpen(filename)
if err != nil {
return nil, err
}
Expand All @@ -327,7 +334,7 @@ func ListVersions(filename string, key string) ([]int64, error) {
// GetValue scans the bucket of the bolt db file for a etcd v3 record with the given key and returns the value.
// Because bolt db files are indexed by revision
func GetValue(filename string, key string, version int64) ([]byte, error) {
db, err := bolt.Open(filename, 0400, &bolt.Options{})
db, err := boltOpen(filename)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 43b391c

Please sign in to comment.