pathdb

package
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func (s *Segment) Expiration() time.Time

Expiration returns the earliest hop expiration of the segment.

func (*Segment) FirstIA

func (s *Segment) FirstIA() addr.IA

FirstIA returns the ISD-AS of the first entry: the core the segment originates from.

func (*Segment) Key

func (s *Segment) Key() Key

Key returns the segment's identity.

func (*Segment) LastIA

func (s *Segment) LastIA() addr.IA

LastIA returns the ISD-AS of the last entry: the segment's far end.

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).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL