beacondbsqlite

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
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 = `` /* 914-byte string literal not displayed */

	BeaconsTable      = "Beacons"
	IntfToBeaconTable = "IntfToBeacon"
	RevocationsTable  = "Revocations"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct {
	// contains filtered or unexported fields
}

func New

func New(path string, ia addr.IA) (*Backend, error)

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

func (e Backend) AllRevocations(ctx context.Context) (<-chan beacon.RevocationOrErr, error)

func (Backend) BeaconSources

func (e Backend) BeaconSources(ctx context.Context) ([]addr.IA, error)

func (*Backend) BeginTransaction

func (b *Backend) BeginTransaction(ctx context.Context,
	opts *sql.TxOptions) (beacon.Transaction, error)

BeginTransaction begins a transaction on the database.

func (Backend) CandidateBeacons

func (e Backend) CandidateBeacons(ctx context.Context, setSize int, usage beacon.Usage,
	src addr.IA) (<-chan beacon.BeaconOrErr, error)

func (*Backend) Close

func (b *Backend) Close() error

Close closes the database.

func (Backend) DeleteExpiredBeacons

func (e Backend) DeleteExpiredBeacons(ctx context.Context, now time.Time) (int, error)

func (Backend) DeleteExpiredRevocations

func (e Backend) DeleteExpiredRevocations(ctx context.Context, now time.Time) (int, error)

func (Backend) DeleteRevocation

func (e Backend) DeleteRevocation(ctx context.Context, ia addr.IA, ifid common.IFIDType) error

func (Backend) DeleteRevokedBeacons

func (e Backend) DeleteRevokedBeacons(ctx context.Context, now time.Time) (int, error)

func (Backend) InsertBeacon

func (e Backend) InsertBeacon(ctx context.Context, b beacon.Beacon,
	usage beacon.Usage) (beacon.InsertStats, error)

InsertBeacon inserts the beacon if it is new or updates the changed information.

func (Backend) InsertRevocation

func (e Backend) InsertRevocation(ctx context.Context,
	revocation *path_mgmt.SignedRevInfo) error

func (*Backend) SetMaxIdleConns

func (b *Backend) SetMaxIdleConns(maxIdleConns int)

SetMaxIdleConns sets the maximum number of idle connections.

func (*Backend) SetMaxOpenConns

func (b *Backend) SetMaxOpenConns(maxOpenConns int)

SetMaxOpenConns sets the maximum number of open connections.

Jump to

Keyboard shortcuts

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