forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kv: consolidate range lease construction
This commit consolidates the creation of lease objects into one place, a new `kv/kvserver/leases` package. This avoids the diffuse construction of leases that was previously spread between `replica_range_lease.go`, `cmd_lease_request.go`, `cmd_lease_transfer.go`, and `cmd_lease.go`. This makes the logic easier to understand and easier to test. It will also make the logic easier to adjust when we add support for leader leases. First part of cockroachdb#123498. The next PR will consolidate lease validation logic (before latches, after latches, before proposing) into one place. Release note: None
- Loading branch information
1 parent
2025c44
commit 06d666e
Showing
16 changed files
with
1,293 additions
and
344 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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
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,30 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") | ||
|
||
go_library( | ||
name = "leases", | ||
srcs = ["build.go"], | ||
importpath = "github.com/cockroachdb/cockroach/pkg/kv/kvserver/leases", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//pkg/kv/kvpb", | ||
"//pkg/kv/kvserver/kvserverpb", | ||
"//pkg/kv/kvserver/liveness", | ||
"//pkg/kv/kvserver/liveness/livenesspb", | ||
"//pkg/roachpb", | ||
"//pkg/util/hlc", | ||
"@com_github_cockroachdb_errors//:errors", | ||
], | ||
) | ||
|
||
go_test( | ||
name = "leases_test", | ||
srcs = ["build_test.go"], | ||
embed = [":leases"], | ||
deps = [ | ||
"//pkg/kv/kvserver/liveness", | ||
"//pkg/kv/kvserver/liveness/livenesspb", | ||
"//pkg/roachpb", | ||
"//pkg/util/hlc", | ||
"@com_github_stretchr_testify//require", | ||
], | ||
) |
Oops, something went wrong.