Skip to content

Commit

Permalink
snet: make PathMetadata a struct (#3923)
Browse files Browse the repository at this point in the history
Make `snet.PathMetadata` a struct instead of an interface. Analogous to how this was done for `snet.PathInterface` (#3879).
The indirection with an interface is simply unnecessary.
Making this a struct, will allow to extend the `PathMetadata` struct quite easily: in a next PR, we'll add the latency, bandwidth, geo coordinates etc. from the "static info" beaconing extension (currently, these fields are defined in a shadow copy of `PathMetadata` in `combinator/staticinfo_accumulator.go`).

Move `Interfaces` to `snet.PathMetadata`. The `Interfaces` list is available exactly if the other metadata items are available, so it makes sense to bundle these.
This requires/brings some changes to `pathpol.PathSet` -- now the pathpol is fed directly with the `snet.PathMetadata` struct. This seems quite natural, as it's conceivable that the path policy would access all the various metadata items in the future.
This change also requires some minor adjustments at the call sites for the path policies.
  • Loading branch information
matzf authored Nov 5, 2020
1 parent 20c62ae commit 519d50a
Show file tree
Hide file tree
Showing 40 changed files with 178 additions and 642 deletions.
25 changes: 2 additions & 23 deletions go/cs/segutil/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,34 +1,13 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "go_default_library",
srcs = [
"filter.go",
"router.go",
],
srcs = ["router.go"],
importpath = "github.com/scionproto/scion/go/cs/segutil",
visibility = ["//visibility:public"],
deps = [
"//go/lib/addr:go_default_library",
"//go/lib/common:go_default_library",
"//go/lib/ctrl/seg:go_default_library",
"//go/lib/infra/modules/segfetcher:go_default_library",
"//go/lib/pathpol:go_default_library",
"//go/lib/snet:go_default_library",
],
)

go_test(
name = "go_default_test",
srcs = ["filter_test.go"],
embed = [":go_default_library"],
deps = [
"//go/cs/segutil/mock_segutil:go_default_library",
"//go/lib/common:go_default_library",
"//go/lib/ctrl/seg:go_default_library",
"//go/lib/pathpol:go_default_library",
"//go/lib/xtest/graph:go_default_library",
"@com_github_golang_mock//gomock:go_default_library",
"@com_github_stretchr_testify//assert:go_default_library",
],
)
115 changes: 0 additions & 115 deletions go/cs/segutil/filter.go

This file was deleted.

95 changes: 0 additions & 95 deletions go/cs/segutil/filter_test.go

This file was deleted.

21 changes: 0 additions & 21 deletions go/cs/segutil/mock_segutil/BUILD.bazel

This file was deleted.

48 changes: 0 additions & 48 deletions go/cs/segutil/mock_segutil/mock.go

This file was deleted.

2 changes: 1 addition & 1 deletion go/lib/infra/messenger/addr.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func (r AddressRewriter) buildFullAddress(ctx context.Context,
}()

// SVC addresses in the local AS get resolved via topology lookup
if len(p.Interfaces()) == 0 { //when local AS
if len(p.Metadata().Interfaces) == 0 { //when local AS
ov, err := r.SVCRouter.GetUnderlay(s.SVC)
if err != nil {
return nil, common.NewBasicError("Unable to resolve underlay", err)
Expand Down
Loading

0 comments on commit 519d50a

Please sign in to comment.