From 98f359c5b7797494d07292e6cff248f613c34aa3 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Fri, 30 Sep 2022 14:17:08 +0200 Subject: [PATCH] etcd: fix typos --- kvdb/etcd/bucket.go | 2 +- kvdb/etcd/db.go | 8 ++++---- kvdb/etcd/fixture.go | 6 +++--- kvdb/etcd/readwrite_bucket.go | 10 +++++----- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/kvdb/etcd/bucket.go b/kvdb/etcd/bucket.go index ed548db7c..b51c673f7 100644 --- a/kvdb/etcd/bucket.go +++ b/kvdb/etcd/bucket.go @@ -92,7 +92,7 @@ func getKeyVal(kv *KV) ([]byte, []byte) { return getKey(kv.key), val } -// BucketKey is a helper functon used in tests to create a bucket key from +// BucketKey is a helper function used in tests to create a bucket key from // passed bucket list. func BucketKey(buckets ...string) string { var bucketKey []byte diff --git a/kvdb/etcd/db.go b/kvdb/etcd/db.go index 119816c85..30b996eed 100644 --- a/kvdb/etcd/db.go +++ b/kvdb/etcd/db.go @@ -22,7 +22,7 @@ const ( // the etcd instance. etcdConnectionTimeout = 10 * time.Second - // etcdLongTimeout is a timeout for longer taking etcd operatons. + // etcdLongTimeout is a timeout for longer taking etcd operations. etcdLongTimeout = 30 * time.Second // etcdDefaultRootBucketId is used as the root bucket key. Note that @@ -52,8 +52,8 @@ type commitStatsCollector struct { fail map[string]*callerStats } -// newCommitStatsColletor creates a new commitStatsCollector instance. -func newCommitStatsColletor() *commitStatsCollector { +// newCommitStatsCollector creates a new commitStatsCollector instance. +func newCommitStatsCollector() *commitStatsCollector { return &commitStatsCollector{ succ: make(map[string]*callerStats), fail: make(map[string]*callerStats), @@ -181,7 +181,7 @@ func newEtcdBackend(ctx context.Context, cfg Config) (*db, error) { } if cfg.CollectStats { - backend.commitStatsCollector = newCommitStatsColletor() + backend.commitStatsCollector = newCommitStatsCollector() } return backend, nil diff --git a/kvdb/etcd/fixture.go b/kvdb/etcd/fixture.go index 8f0e0af7f..5467f1be3 100644 --- a/kvdb/etcd/fixture.go +++ b/kvdb/etcd/fixture.go @@ -41,8 +41,8 @@ func NewTestEtcdInstance(t *testing.T, path string) (*Config, func()) { return config, cleanup } -// NewTestEtcdTestFixture creates a new etcd-test fixture. This is helper -// object to facilitate etcd tests and ensure pre and post conditions. +// NewEtcdTestFixture creates a new etcd-test fixture. This is helper +// object to facilitate etcd tests and ensure pre- and post-conditions. func NewEtcdTestFixture(t *testing.T) *EtcdTestFixture { tmpDir := t.TempDir() @@ -128,7 +128,7 @@ func (f *EtcdTestFixture) Dump() map[string]string { return result } -// BackendConfig returns the backend config for connecting to theembedded +// BackendConfig returns the backend config for connecting to the embedded // etcd instance. func (f *EtcdTestFixture) BackendConfig() Config { return *f.config diff --git a/kvdb/etcd/readwrite_bucket.go b/kvdb/etcd/readwrite_bucket.go index 16fc892a7..38b5585ca 100644 --- a/kvdb/etcd/readwrite_bucket.go +++ b/kvdb/etcd/readwrite_bucket.go @@ -318,7 +318,7 @@ func (b *readWriteBucket) DeleteNestedBucket(key []byte) error { } // Put updates the value for the passed key. -// Returns ErrKeyRequred if te passed key is empty. +// Returns ErrKeyRequired if the passed key is empty. func (b *readWriteBucket) Put(key, value []byte) error { if len(key) == 0 { return walletdb.ErrKeyRequired @@ -335,7 +335,7 @@ func (b *readWriteBucket) Put(key, value []byte) error { } // Delete deletes the key/value pointed to by the passed key. -// Returns ErrKeyRequred if the passed key is empty. +// Returns ErrKeyRequired if the passed key is empty. func (b *readWriteBucket) Delete(key []byte) error { if key == nil { return nil @@ -360,7 +360,7 @@ func (b *readWriteBucket) Tx() walletdb.ReadWriteTx { return b.tx } -// NextSequence returns an autoincrementing sequence number for this bucket. +// NextSequence returns an auto-incrementing sequence number for this bucket. // Note that this is not a thread safe function and as such it must not be used // for synchronization. func (b *readWriteBucket) NextSequence() (uint64, error) { @@ -396,7 +396,7 @@ func (b *readWriteBucket) Sequence() uint64 { return 0 } - // Otherwise try to parse a 64 bit unsigned integer from the value. + // Otherwise try to parse a 64-bit unsigned integer from the value. num, _ := strconv.ParseUint(string(val), 10, 64) return num @@ -414,7 +414,7 @@ func flattenMap(m map[string]struct{}) []string { return result } -// Prefetch will prefetch all keys in the passed paths as well as all bucket +// Prefetch will prefetch all keys in the passed-in paths as well as all bucket // keys along the paths. func (b *readWriteBucket) Prefetch(paths ...[]string) { keys := make(map[string]struct{})