Documentation ¶
Overview ¶
Package segfetcher contains all the logic that is needed to fetch segments, verify and store segments in an efficient manner. It is designed to be pluggable into the daemon and control service.
Index ¶
- Variables
- func ErrToMetricsLabel(err error) string
- func NewFetcherMetrics(ns string) metrics.Fetcher
- type DefaultRequester
- type DefaultResolver
- type DstProvider
- type Fetcher
- type LocalInfo
- type MultiSegmentSplitter
- type Pather
- type RPC
- type ReplyHandler
- type ReplyOrErr
- type Request
- type Requester
- type Requests
- type Resolver
- type Segments
- type SegmentsReply
- type Splitter
Constants ¶
This section is empty.
Variables ¶
var (
ErrBadDst = errors.New("bad destination AS")
)
Pather errors.
var ErrInvalidRequest = serrors.New("invalid request")
ErrInvalidRequest indicates an invalid request.
var ErrNotReachable = serrors.New("remote not reachable")
ErrNotReachable indicates that the destination is not reachable from this process.
Functions ¶
func ErrToMetricsLabel ¶
ErrToMetricsLabel classifies the error from the segfetcher into metrics labels.
func NewFetcherMetrics ¶
NewFetcherMetrics exposes the metrics constructor.
XXX(roosd): This should be translated to the new metrics approach.
Types ¶
type DefaultRequester ¶
type DefaultRequester struct { RPC RPC DstProvider DstProvider MaxRetries int }
DefaultRequester requests all segments that can be requested from a request set.
func (*DefaultRequester) Request ¶
func (r *DefaultRequester) Request(ctx context.Context, reqs Requests) <-chan ReplyOrErr
Request all requests in the request set
type DefaultResolver ¶
DefaultResolver is the default resolver implementation.
func NewResolver ¶
func NewResolver(DB pathdb.ReadWrite, revCache revcache.RevCache, localInfo LocalInfo) *DefaultResolver
NewResolver creates a new resolver with the given DB.
func (*DefaultResolver) Resolve ¶
func (r *DefaultResolver) Resolve(ctx context.Context, reqs Requests, refresh bool) (Segments, Requests, error)
Resolve resolves requests. It loads the segments that are locally available from the DB and returns the set of requests that have to be requested at a remote server.
type DstProvider ¶
DstProvider provides the destination for a segment lookup including the path.
type Fetcher ¶
type Fetcher struct { Resolver Resolver Requester Requester ReplyHandler ReplyHandler PathDB pathdb.DB // QueryInterval specifies after how much time segments should be // refetched at the remote server. QueryInterval time.Duration Metrics metrics.Fetcher }
Fetcher fetches, verifies and stores segments for a path segment request.
type LocalInfo ¶
type LocalInfo interface { // IsSegLocal returns whether the requested segment is always locally stored. IsSegLocal(req Request) bool }
LocalInfo provides information about which segments are always locally stored.
type MultiSegmentSplitter ¶
MultiSegmentSplitter splits requests consisting of one or multiple segments. The AS inspector is used to check whether an IA is core or not.
type Pather ¶
type Pather struct { IA addr.IA MTU uint16 NextHopper interface { UnderlayNextHop(uint16) *net.UDPAddr } RevCache revcache.RevCache Fetcher *Fetcher Splitter Splitter }
Pather is used to construct paths from the path database. If necessary, paths are fetched over the network.
type RPC ¶
type RPC interface {
Segments(ctx context.Context, req Request, dst net.Addr) (SegmentsReply, error)
}
RPC is used to fetch segments from a remote.
type ReplyHandler ¶
type ReplyHandler interface { Handle(ctx context.Context, recs seghandler.Segments, server net.Addr) *seghandler.ProcessedResult }
ReplyHandler handles replies.
type ReplyOrErr ¶
ReplyOrErr is a seg reply or an error for the given request.
type Request ¶
Request represents a path or segment request.
type Requester ¶
type Requester interface {
Request(ctx context.Context, req Requests) <-chan ReplyOrErr
}
Requester requests segments.
type Requests ¶
type Requests []Request
Requests is a list of requests and provides some convenience methods on top of it.
type Resolver ¶
type Resolver interface { // Resolve resolves requests. It loads the segments that are locally available // from the DB and returns the set of requests that have to be requested at a // remote server. Resolve(ctx context.Context, reqs Requests, refresh bool) (Segments, Requests, error) }
Resolver resolves segments that are locally cached.
type SegmentsReply ¶
SegmentsReply represents the segments received from an RPC. It also includes meta data like the Peer address that is to be used for verification.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
Package mock_segfetcher is a generated GoMock package.
|
Package mock_segfetcher is a generated GoMock package. |