-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
itopo: Add svc validator #2402
itopo: Add svc validator #2402
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 9 of 9 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @oncilla)
go/lib/infra/modules/itopo/validate.go, line 130 at r1 (raw file):
// It checks that the service is present, and only permissible updates are done. type svcValidator struct { generalValidator
Do you care about embedding here (i.e., is generalValidator
implementing some vanilla aspect that you can use without changing it at all)?
If you never call methods on svcValidator
that go directly to generalValidator
, changing generalValidator
to a normal field is a bit safer because it makes code easier to refactor in the future (it means future changes to generalValidator
won't inadvertently enrich the API of svcValidator
, and no accidental calls can be made go generalValidator
s methods).
go/lib/topology/topology.go, line 287 at r1 (raw file):
} func (t *Topo) GetTopoAddrs(id string, svc proto.ServiceType) (*TopoAddr, error) {
I decided not to comment on the last PR, but I think it's clearer if this were named GetTopoAddr
, as it only returns one TopoAddr
type object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @scrye)
go/lib/infra/modules/itopo/validate.go, line 130 at r1 (raw file):
Previously, scrye (Sergiu Costea) wrote…
Do you care about embedding here (i.e., is
generalValidator
implementing some vanilla aspect that you can use without changing it at all)?If you never call methods on
svcValidator
that go directly togeneralValidator
, changinggeneralValidator
to a normal field is a bit safer because it makes code easier to refactor in the future (it means future changes togeneralValidator
won't inadvertently enrich the API ofsvcValidator
, and no accidental calls can be made gogeneralValidator
s methods).
We directly reuse SemiMutable
and MustDropDynamic
.
I can also re-implement, if you want.
(I have no strong opinion whether it should be an embedding or field.)
go/lib/topology/topology.go, line 287 at r1 (raw file):
Previously, scrye (Sergiu Costea) wrote…
I decided not to comment on the last PR, but I think it's clearer if this were named
GetTopoAddr
, as it only returns oneTopoAddr
type object.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r2.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @oncilla)
go/lib/infra/modules/itopo/validate.go, line 130 at r1 (raw file):
Previously, Oncilla wrote…
We directly reuse
SemiMutable
andMustDropDynamic
.
I can also re-implement, if you want.(I have no strong opinion whether it should be an embedding or field.)
Nah, it's fine, generalValidator
is so basic that refactoring probably won't be a problem, so if the embedding saves a few lines of code it's probably a gain.
e75b6ea
to
54465db
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r3.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @oncilla)
acceptance/topo_invalid_reloads_acceptance/test, line 57 at r3 (raw file):
./tools/dc scion kill -s HUP scion_"$1" sleep 1 grep -q "Reloaded topology" "logs/$1.log" || local failed=$?
It's safer to test for the presence of the Unable to set topology message
, because there are multiple branches that can exit ReloadTopo
without the topology getting successfully reloaded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 10 of 11 files reviewed, 2 unresolved discussions (waiting on @scrye)
acceptance/topo_invalid_reloads_acceptance/test, line 57 at r3 (raw file):
Previously, scrye (Sergiu Costea) wrote…
It's safer to test for the presence of the
Unable to set topology message
, because there are multiple branches that can exitReloadTopo
without the topology getting successfully reloaded.
Done.
Add validator for infra services according to `itopo/doc.go`
13f84ed
to
965c309
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r4.
Reviewable status:complete! all files reviewed, all discussions resolved
Add validator for infra services according to
itopo/doc.go
This change is![Reviewable](https://camo.githubusercontent.com/1541c4039185914e83657d3683ec25920c672c6c5c7ab4240ee7bff601adec0b/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)