Skip to content
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

Merged
merged 2 commits into from
Jul 24, 2019

Conversation

lukedirtwalker
Copy link
Collaborator

@lukedirtwalker lukedirtwalker commented Jul 24, 2019

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

@lukedirtwalker lukedirtwalker requested a review from oncilla July 24, 2019 08:19
Copy link
Contributor

@oncilla oncilla left a 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)

Copy link
Contributor

@oncilla oncilla left a 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
Copy link
Contributor

@oncilla oncilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 2 of 2 files at r2.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @lukedirtwalker)

Copy link
Collaborator Author

@lukedirtwalker lukedirtwalker left a 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 or isISDLocal

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.

Copy link
Contributor

@oncilla oncilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@lukedirtwalker lukedirtwalker merged commit d0d1b10 into scionproto:master Jul 24, 2019
@lukedirtwalker lukedirtwalker deleted the pubReqSplitter branch July 24, 2019 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants