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 inserts the segment, replacing the stored segment with the same
// identity. It reports whether the segment was newly inserted.
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.
type Key ¶
type Key struct {
// Origin is the ISD-AS of the first AS entry.
Origin addr.IA
// ID is the segment identifier.
ID uint16
// Timestamp is the creation timestamp.
Timestamp time.Time
}
Key identifies a segment by origin, segment ID, and creation timestamp; a newly registered segment replaces the stored segment with the same identity.
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). |