Repository navigation
nodestore: an absent node is ErrNodeNotExists and nothing else - #27
Merged
Merged
Conversation
Get on one exact etcd key matches at most one entry, so the ErrInvaildCount branch was unreachable, and CheckAbsent treating ErrInvaildCount as absent would have hidden a real inconsistency had it ever fired. Adds the package's first tests (absent, present, store error).
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the resource-extend side of the not-found cleanup started in projecteru2/core#756 and projecteru2/core#757.
Two problems fixed
Store.Getreads one exact etcd key withoutWithPrefix. etcd answers that read with at most one match, sodefault: ErrInvaildCountwas unreachable.Getnow has two outcomes: zero matches returnsErrNodeNotExists, and one match returns the decoded value.CheckAbsenttreatedErrInvaildCountas "absent". If that branch had ever fired, it would have hidden an inconsistency behind a green node add.CheckAbsentnow accepts onlyErrNodeNotExists.Dependencies
GetOneerrors, because it uses the raw etcd client. No core bump is needed.go.etcd.io/etcd/api/v3moves from indirect to direct at the same version, because the new test buildsmvccpb.KeyValue.Tests
This adds the package's first tests.
TestGetAndCheckAbsentuses a fakeKVand covers three cases for bothGetandCheckAbsent: node absent, node present, and a store error that propagates.Gates, all run with
GOWORK=off:make fmt-checkpasses.make lintreports 0 issues on linux and darwin.aslis clean on linux and darwin.make testandmake buildpass.