sqlite

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 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 = 9
	// Schema is the SQLite database layout.
	Schema = `` /* 1285-byte string literal not displayed */

	SegmentsTable   = "Segments"
	IntfToSegTable  = "IntfToSeg"
	StartsAtTable   = "StartsAt"
	EndsAtTable     = "EndsAt"
	SegTypesTable   = "SegTypes"
	HPGroupIDsTable = "HPGroupIDs"
	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

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

func (*Backend) Close

func (b *Backend) Close() error

func (Backend) DeleteExpired

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

func (Backend) Get

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

func (Backend) GetAll

func (e Backend) GetAll(ctx context.Context) (query.Results, error)

func (Backend) GetNextQuery

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

func (Backend) Insert

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

func (Backend) InsertNextQuery

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

func (Backend) InsertWithHPGroupIDs

func (e Backend) InsertWithHPGroupIDs(ctx context.Context, segMeta *seg.Meta,
	hpGroupIDs []uint64) (pathdb.InsertStats, error)

func (*Backend) SetMaxIdleConns

func (b *Backend) SetMaxIdleConns(maxIdleConns int)

func (*Backend) SetMaxOpenConns

func (b *Backend) SetMaxOpenConns(maxOpenConns int)

Jump to

Keyboard shortcuts

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