pathdb

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 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 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

type Hop struct {
	IA      addr.IA
	Ingress uint16
	Egress  uint16
}

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

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