-
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
Introduce request splitter #2898
Introduce request splitter #2898
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 4 of 7 files at r1.
Reviewable status: 4 of 7 files reviewed, all discussions resolved (waiting on @oncilla)
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 3 of 7 files at r1.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @lukedirtwalker)
go/lib/infra/modules/segfetcher/request.go, line 39 at r1 (raw file):
// IsEmpty returns whether the request set is empty. func (r RequestSet) IsEmpty() bool { return r.Up.IsZero() && len(r.Cores) == 0 && r.Down.IsZero()
add method Requests.IsEmpty
go/lib/infra/modules/segfetcher/request.go, line 59 at r1 (raw file):
var ias []addr.IA addrs := make(map[addr.IA]struct{}) for _, req := range r {
I think the following is easier to understand: (plus, probably faster anyway)
set := make(map[addr.IA]struct{})
for _, req := range r {
set[extract(ia)] = struct{}{}
}
ias := make([]addr.IA, 0, len(set))
for ia := range set {
ias = append(ias, ia)
}
return ias
go/lib/infra/modules/segfetcher/splitter.go, line 41 at r1 (raw file):
ctx, cancelF := context.WithTimeout(context.Background(), time.Second) defer cancelF() trc, err := trcProvider.GetTRC(ctx, localIA.I, scrypto.LatestVer)
instead of fetching trc here, you can simply call baseSplitter.IsCore(ctx, localIA)
go/lib/infra/modules/segfetcher/splitter.go, line 76 at r1 (raw file):
} func (s *baseRequestSplitter) isLocal(dst addr.IA) bool {
isLocalISD
or isISDLocal
go/lib/infra/modules/segfetcher/splitter.go, line 99 at r1 (raw file):
} func (s *coreRequestSplitter) Split(ctx context.Context, r Request) (RequestSet, error) {
This does not check that r.Src is core.
This is the first part of the new path lookup strategy. It splits up a request into up, core, and down parts. Contributes scionproto#2454
ee192c2
to
0624f7c
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 r2.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @lukedirtwalker)
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, 1 unresolved discussion (waiting on @oncilla)
go/lib/infra/modules/segfetcher/request.go, line 39 at r1 (raw file):
Previously, Oncilla wrote…
add method
Requests.IsEmpty
Done.
go/lib/infra/modules/segfetcher/request.go, line 59 at r1 (raw file):
Previously, Oncilla wrote…
I think the following is easier to understand: (plus, probably faster anyway)
set := make(map[addr.IA]struct{}) for _, req := range r { set[extract(ia)] = struct{}{} } ias := make([]addr.IA, 0, len(set)) for ia := range set { ias = append(ias, ia) } return ias
Done.
go/lib/infra/modules/segfetcher/splitter.go, line 41 at r1 (raw file):
Previously, Oncilla wrote…
instead of fetching trc here, you can simply call
baseSplitter.IsCore(ctx, localIA)
Done.
go/lib/infra/modules/segfetcher/splitter.go, line 76 at r1 (raw file):
Previously, Oncilla wrote…
isLocalISD
orisISDLocal
Done.
go/lib/infra/modules/segfetcher/splitter.go, line 99 at r1 (raw file):
Previously, Oncilla wrote…
This does not check that r.Src is core.
Validation will happen in a separate function outside of this.
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:
complete! all files reviewed, all discussions resolved
This is the first part of the new path lookup strategy.
It splits up a request into up, core, and down parts.
Contributes #2454
This change is![Reviewable](https://camo.githubusercontent.com/1541c4039185914e83657d3683ec25920c672c6c5c7ab4240ee7bff601adec0b/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)