Documentation ¶
Index ¶
- Constants
- type Backend
- func (b *Backend) BeginTransaction(ctx context.Context, opts *sql.TxOptions) (backend.Transaction, error)
- func (b *Backend) Close() error
- func (x Backend) DeleteExpiredIndices(ctx context.Context, now time.Time) (int, error)
- func (x Backend) DeleteSegmentRsv(ctx context.Context, ID *reservation.SegmentID) error
- func (x Backend) GetAllSegmentRsvs(ctx context.Context) ([]*segment.Reservation, error)
- func (x Backend) GetE2ERsvFromID(ctx context.Context, ID *reservation.E2EID) (*e2e.Reservation, error)
- func (x Backend) GetE2ERsvsOnSegRsv(ctx context.Context, ID *reservation.SegmentID) ([]*e2e.Reservation, error)
- func (x Backend) GetSegmentRsvFromID(ctx context.Context, ID *reservation.SegmentID) (*segment.Reservation, error)
- func (x Backend) GetSegmentRsvFromPath(ctx context.Context, path segment.ReservationTransparentPath) (*segment.Reservation, error)
- func (x Backend) GetSegmentRsvsFromIFPair(ctx context.Context, ingress, egress *uint16) ([]*segment.Reservation, error)
- func (x Backend) GetSegmentRsvsFromSrcDstIA(ctx context.Context, srcIA, dstIA addr.IA) ([]*segment.Reservation, error)
- func (x Backend) NewSegmentRsv(ctx context.Context, rsv *segment.Reservation) error
- func (x Backend) PersistE2ERsv(ctx context.Context, rsv *e2e.Reservation) error
- func (x Backend) PersistSegmentRsv(ctx context.Context, rsv *segment.Reservation) error
- func (b *Backend) SetMaxIdleConns(maxIdleConns int)
- func (b *Backend) SetMaxOpenConns(maxOpenConns int)
Constants ¶
const ( // SchemaVersion is the version of the SQLite schema understood by this backend. // Whenever changes to the schema are made, this version number should be increased // to prevent data corruption between incompatible database schemas. SchemaVersion = 1 // Schema is the SQLite database layout. Schema = `` /* 2141-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
func New ¶
New returns a new SQLite backend opening a database at the given path. If no database exists a new database is be created. If the schema version of the stored database is different from the one in schema.go, an error is returned.
func (*Backend) BeginTransaction ¶
func (b *Backend) BeginTransaction(ctx context.Context, opts *sql.TxOptions) ( backend.Transaction, error)
BeginTransaction begins a transaction on the database.
func (Backend) DeleteExpiredIndices ¶
DeleteExpiredIndices will remove expired indices from the DB. If a reservation is left without any index after removing the expired ones, it will also be removed. This applies to both segment and e2e reservations.
func (Backend) DeleteSegmentRsv ¶
func (x Backend) DeleteSegmentRsv(ctx context.Context, ID *reservation.SegmentID) error
DeleteSegmentRsv removes the segment reservation
func (Backend) GetAllSegmentRsvs ¶
func (x Backend) GetAllSegmentRsvs(ctx context.Context) ([]*segment.Reservation, error)
GetAllSegmentRsvs returns all segment reservations.
func (Backend) GetE2ERsvFromID ¶
func (x Backend) GetE2ERsvFromID(ctx context.Context, ID *reservation.E2EID) ( *e2e.Reservation, error)
GetE2ERsvFromID finds the end to end resevation given its ID.
func (Backend) GetE2ERsvsOnSegRsv ¶
func (x Backend) GetE2ERsvsOnSegRsv(ctx context.Context, ID *reservation.SegmentID) ( []*e2e.Reservation, error)
GetE2ERsvsOnSegRsv returns the e2e reservations running on top of a given segment one.
func (Backend) GetSegmentRsvFromID ¶
func (x Backend) GetSegmentRsvFromID(ctx context.Context, ID *reservation.SegmentID) ( *segment.Reservation, error)
func (Backend) GetSegmentRsvFromPath ¶
func (x Backend) GetSegmentRsvFromPath(ctx context.Context, path segment.ReservationTransparentPath) (*segment.Reservation, error)
GetSegmentRsvFromPath searches for a segment reservation with the specified path.
func (Backend) GetSegmentRsvsFromIFPair ¶
func (x Backend) GetSegmentRsvsFromIFPair(ctx context.Context, ingress, egress *uint16) ( []*segment.Reservation, error)
GetSegmentRsvsFromIFPair returns all segment reservations that enter this AS at the specified ingress and exit at that egress.
func (Backend) GetSegmentRsvsFromSrcDstIA ¶
func (x Backend) GetSegmentRsvsFromSrcDstIA(ctx context.Context, srcIA, dstIA addr.IA) ( []*segment.Reservation, error)
GetSegmentRsvsFromSrcDstIA returns all reservations that start at src AS and end in dst AS.
func (Backend) NewSegmentRsv ¶
func (x Backend) NewSegmentRsv(ctx context.Context, rsv *segment.Reservation) error
NewSegmentRsv creates a new segment reservation in the DB, with an unused reservation ID. The reservation must contain at least one index. The created ID is set in the reservation pointer argument.
func (Backend) PersistE2ERsv ¶
func (x Backend) PersistE2ERsv(ctx context.Context, rsv *e2e.Reservation) error
func (Backend) PersistSegmentRsv ¶
func (x Backend) PersistSegmentRsv(ctx context.Context, rsv *segment.Reservation) error
func (*Backend) SetMaxIdleConns ¶
SetMaxIdleConns sets the maximum number of idle connections.
func (*Backend) SetMaxOpenConns ¶
SetMaxOpenConns sets the maximum number of open connections.