sqlite

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: Apache-2.0 Imports: 15 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 = 8
	// Schema is the SQLite database layout.
	Schema = `` /* 1375-byte string literal not displayed */

	SegmentsTable  = "Segments"
	IntfToSegTable = "IntfToSeg"
	StartsAtTable  = "StartsAt"
	EndsAtTable    = "EndsAt"
	SegTypesTable  = "SegTypes"
	HpCfgIdsTable  = "HpCfgIds"
	NextQueryTable = "NextQuery"
)

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) (*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) BeginTransaction added in v0.4.0

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

func (*Backend) Close added in v0.4.0

func (b *Backend) Close() error

func (Backend) Delete

func (e Backend) Delete(ctx context.Context, params *query.Params) (int, error)

func (Backend) DeleteExpired added in v0.3.0

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

func (Backend) DeleteExpiredNQ added in v0.4.0

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

func (Backend) DeleteNQ added in v0.4.0

func (e Backend) DeleteNQ(ctx context.Context, src, dst addr.IA,
	policy pathdb.PolicyHash) (int, error)

func (Backend) Get

func (e Backend) Get(ctx context.Context, params *query.Params) (query.Results, error)

func (Backend) GetAll added in v0.4.0

func (e Backend) GetAll(ctx context.Context) (<-chan query.ResultOrErr, error)

func (Backend) GetNextQuery added in v0.3.0

func (e Backend) GetNextQuery(ctx context.Context, src, dst addr.IA,
	policy pathdb.PolicyHash) (time.Time, error)

func (Backend) Insert

func (e Backend) Insert(ctx context.Context, segMeta *seg.Meta) (pathdb.InsertStats, error)

func (Backend) InsertNextQuery added in v0.3.0

func (e Backend) InsertNextQuery(ctx context.Context, src, dst addr.IA, policy pathdb.PolicyHash,
	nextQuery time.Time) (bool, error)

func (Backend) InsertWithHPCfgIDs

func (e Backend) InsertWithHPCfgIDs(ctx context.Context, segMeta *seg.Meta,
	hpCfgIDs []*query.HPCfgID) (pathdb.InsertStats, error)

func (*Backend) SetMaxIdleConns added in v0.4.0

func (b *Backend) SetMaxIdleConns(maxIdleConns int)

func (*Backend) SetMaxOpenConns added in v0.4.0

func (b *Backend) SetMaxOpenConns(maxOpenConns int)

Jump to

Keyboard shortcuts

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