-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kv: extract etcd/raft utilities into raftutil library
This commit extracts some scattered logic to interpret the state of an etcd/raft Status into a new `raftutil` library. The library initially has two functions: `ReplicaIsBehind` and `ReplicaMayNeedSnapshot`. In the future, I expect that we'll extract more helper functions that make working with etcd/raft easier into this library.
- Loading branch information
1 parent
ae82018
commit 78ed26c
Showing
13 changed files
with
462 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") | ||
|
||
go_library( | ||
name = "raftutil", | ||
srcs = ["util.go"], | ||
importpath = "github.com/cockroachdb/cockroach/pkg/kv/kvserver/raftutil", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//pkg/roachpb", | ||
"@io_etcd_go_etcd_raft_v3//:raft", | ||
"@io_etcd_go_etcd_raft_v3//tracker", | ||
], | ||
) | ||
|
||
go_test( | ||
name = "raftutil_test", | ||
srcs = ["util_test.go"], | ||
embed = [":raftutil"], | ||
deps = [ | ||
"@com_github_stretchr_testify//require", | ||
"@io_etcd_go_etcd_raft_v3//:raft", | ||
"@io_etcd_go_etcd_raft_v3//tracker", | ||
], | ||
) |
Oops, something went wrong.