Skip to content

Commit 9ea85b8

Browse files
Merge pull request #64 from wzshiming/bump/etcd
Bump etcd dependency
2 parents b2c0dc2 + 2b2cea5 commit 9ea85b8

File tree

5 files changed

+25
-14
lines changed

5 files changed

+25
-14
lines changed

cmd/decode_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ import (
2424
"strings"
2525
"testing"
2626

27-
"github.com/coreos/etcd/mvcc/mvccpb"
2827
"github.com/etcd-io/auger/pkg/encoding"
28+
29+
"go.etcd.io/etcd/api/v3/mvccpb"
2930
)
3031

3132
var decodeTests = []struct {

cmd/extract.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@ import (
2424
"strconv"
2525
"strings"
2626

27-
"github.com/coreos/etcd/mvcc/mvccpb"
2827
"github.com/etcd-io/auger/pkg/data"
2928
"github.com/etcd-io/auger/pkg/encoding"
3029
"github.com/etcd-io/auger/pkg/scheme"
3130
"github.com/google/safetext/yamltemplate"
3231
"github.com/spf13/cobra"
32+
33+
"go.etcd.io/etcd/api/v3/mvccpb"
3334
)
3435

3536
var (

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ module github.com/etcd-io/auger
33
go 1.22.0
44

55
require (
6-
github.com/coreos/bbolt v1.3.1-coreos.3
7-
github.com/coreos/etcd v3.1.11+incompatible
86
github.com/google/safetext v0.0.0-20220914124124-e18e3fe012bf
97
github.com/spf13/cobra v1.8.0
8+
go.etcd.io/bbolt v1.3.10
9+
go.etcd.io/etcd/api/v3 v3.5.13
1010
gopkg.in/yaml.v2 v2.4.0
1111
k8s.io/api v0.30.1
1212
k8s.io/apimachinery v0.30.1

go.sum

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
github.com/coreos/bbolt v1.3.1-coreos.3 h1:sP70znHBV8469pbVsmR2G6wvd2oQwgxtgWyZvV3KVBo=
2-
github.com/coreos/bbolt v1.3.1-coreos.3/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
3-
github.com/coreos/etcd v3.1.11+incompatible h1:8Zwb+fsI+3wXGp23Pjn1eEFE/3P5ib5yXVoAMRxFOgM=
4-
github.com/coreos/etcd v3.1.11+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
51
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
62
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
73
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
@@ -50,6 +46,10 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT
5046
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
5147
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
5248
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
49+
go.etcd.io/bbolt v1.3.10 h1:+BqfJTcCzTItrop8mq/lbzL8wSGtj94UO/3U31shqG0=
50+
go.etcd.io/bbolt v1.3.10/go.mod h1:bK3UQLPJZly7IlNmV7uVHJDxfe5aK9Ll93e/74Y9oEQ=
51+
go.etcd.io/etcd/api/v3 v3.5.13 h1:8WXU2/NBge6AUF1K1gOexB6e07NgsN1hXK0rSTtgSp4=
52+
go.etcd.io/etcd/api/v3 v3.5.13/go.mod h1:gBqlqkcMMZMVTMm4NDZloEVJzxQOQIls8splbqBDa0c=
5353
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
5454
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
5555
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
@@ -64,6 +64,8 @@ golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
6464
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
6565
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
6666
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
67+
golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE=
68+
golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
6769
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
6870
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
6971
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=

pkg/data/data.go

+13-6
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@ import (
2626
"strings"
2727
"text/template"
2828

29-
bolt "github.com/coreos/bbolt"
30-
"github.com/coreos/etcd/mvcc/mvccpb"
3129
"github.com/etcd-io/auger/pkg/encoding"
3230
"k8s.io/apimachinery/pkg/runtime"
3331
"k8s.io/apimachinery/pkg/runtime/serializer"
32+
33+
bolt "go.etcd.io/bbolt"
34+
"go.etcd.io/etcd/api/v3/mvccpb"
3435
)
3536

3637
// See etcd/mvcc/kvstore.go:keyBucketName
@@ -150,13 +151,19 @@ type Checksum struct {
150151
CompactRevision int64
151152
}
152153

154+
func boltOpen(path string) (*bolt.DB, error) {
155+
return bolt.Open(path, 0400, &bolt.Options{
156+
ReadOnly: true,
157+
})
158+
}
159+
153160
// HashByRevision returns the checksum and revision. The checksum is of the live keyspace at a
154161
// particular revision. It is equivalent to performing a range request of all key-value pairs can
155162
// computing a hash of the data. If revision is 0, the latest revision is checksumed, else revision
156163
// is checksumed. The resulting hash is consistent particular revision in the presence of
157164
// compactions; so long as the revions itself has not been compacted, the hash never changes.
158165
func HashByRevision(filename string, revision int64) (Checksum, error) {
159-
db, err := bolt.Open(filename, 0400, &bolt.Options{})
166+
db, err := boltOpen(filename)
160167
if err != nil {
161168
return Checksum{}, err
162169
}
@@ -203,7 +210,7 @@ func getCompactRevision(db *bolt.DB) (int64, error) {
203210
// ListKeySummaries returns a result set with all the provided filters and projections applied.
204211
func ListKeySummaries(codecs serializer.CodecFactory, filename string, filters []Filter, proj *KeySummaryProjection, revision int64) ([]*KeySummary, error) {
205212
var err error
206-
db, err := bolt.Open(filename, 0400, &bolt.Options{})
213+
db, err := boltOpen(filename)
207214
if err != nil {
208215
return nil, err
209216
}
@@ -304,7 +311,7 @@ func sortKeySummaries(m map[string]*KeySummary) []*KeySummary {
304311

305312
// ListVersions lists all versions of a object with the given key.
306313
func ListVersions(filename string, key string) ([]int64, error) {
307-
db, err := bolt.Open(filename, 0400, &bolt.Options{})
314+
db, err := boltOpen(filename)
308315
if err != nil {
309316
return nil, err
310317
}
@@ -327,7 +334,7 @@ func ListVersions(filename string, key string) ([]int64, error) {
327334
// GetValue scans the bucket of the bolt db file for a etcd v3 record with the given key and returns the value.
328335
// Because bolt db files are indexed by revision
329336
func GetValue(filename string, key string, version int64) ([]byte, error) {
330-
db, err := bolt.Open(filename, 0400, &bolt.Options{})
337+
db, err := boltOpen(filename)
331338
if err != nil {
332339
return nil, err
333340
}

0 commit comments

Comments
 (0)