Documentation
¶
Overview ¶
Package pathdb stores registered path segments (control plane draft, Section 4): up, down, and core segments terminated by this node or registered with it. Beneath the contract, one package per implementation and shared contract tests in impl/dbtest.
Kind: storage — where segments persist, bound by the assembly; no run argument names a backend.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB interface {
// Insert stores the segment unless the stored segment with its key is at
// least as fresh, and reports whether it stored the segment.
Insert(ctx context.Context, seg *Segment) (bool, error)
// Get returns the unexpired segments matching the query.
Get(ctx context.Context, q Query) ([]*Segment, error)
// DeleteExpired evicts the segments whose expiration passed before the
// given time, and reports how many were evicted.
DeleteExpired(ctx context.Context, t time.Time) (int, error)
Close() error
}
DB is the database of registered path segments: one segment per key, the freshest by creation timestamp.
type Hop ¶ added in v0.0.8
Hop is one AS entry's place on a route: its ISD-AS and its ingress and egress interface IDs in construction direction, zero at the segment's ends.
type Key ¶
type Key struct {
// Type is the segment's role for this node.
Type SegmentType
// Route is the segment's AS entries in construction order, the
// originating core first.
Route []Hop
}
Key identifies a segment by its type and its route. Every origination over one route shares the key — each draws a fresh segment ID and timestamp, but the links it crosses are the route's — so a store holds one segment per route and type, however often the route is beaconed.
type Query ¶
type Query struct {
// Type selects the segment type; SegmentTypeUnspecified selects any.
Type SegmentType
// SrcIA matches the first AS entry; a zero IA matches any.
SrcIA addr.IA
// DstIA matches the last AS entry; a zero IA matches any.
DstIA addr.IA
}
Query selects stored segments.
type Segment ¶
type Segment struct {
// Type is the segment's role for this node.
Type SegmentType
// PCB is the terminated segment.
PCB *segment.PCB
}
Segment is a registered path segment: a terminated PCB and its type.
func NewSegment ¶
func NewSegment(t SegmentType, pb *cppb.PathSegment) (*Segment, error)
NewSegment parses the wire message into a typed segment.
func (*Segment) Expiration ¶
Expiration returns the earliest hop expiration of the segment.
type SegmentType ¶
type SegmentType int32
SegmentType mirrors the draft's segment types: the role a stored segment plays for the node whose database it lives in.
const ( // SegmentTypeUnspecified matches the draft's unspecified type. SegmentTypeUnspecified SegmentType = 0 // SegmentTypeUp is a segment from a core to this node, kept locally as // this node's route to the core (Section 3.1.2). SegmentTypeUp SegmentType = 1 // SegmentTypeDown is a segment from a core to a non-core, registered // with the originating core (Sections 3.1.3 and 3.3). SegmentTypeDown SegmentType = 2 // SegmentTypeCore is a segment between cores (Section 3.2). SegmentTypeCore SegmentType = 3 )
Directories
¶
| Path | Synopsis |
|---|---|
|
impl
|
|
|
bbolt
Package bbolt implements the path segment database on top of bbolt, following the trust DB's implementation (pkg/modules/trustdb/impl/bbolt).
|
Package bbolt implements the path segment database on top of bbolt, following the trust DB's implementation (pkg/modules/trustdb/impl/bbolt). |
|
dbtest
Package dbtest implements the shared contract tests for path database implementations, following the trust DB's testing harness (pkg/modules/trustdb/impl/dbtest).
|
Package dbtest implements the shared contract tests for path database implementations, following the trust DB's testing harness (pkg/modules/trustdb/impl/dbtest). |