trustdbsqlite

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2020 License: Apache-2.0 Imports: 16 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 = `` /* 749-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
}

Backend implements the trust DB with an SQLite backend.

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) (trust.Transaction, error)

BeginTransaction begins a transaction on the database.

func (Backend) ChainExists

func (e Backend) ChainExists(ctx context.Context, d decoded.Chain) (bool, error)

func (*Backend) Close

func (b *Backend) Close() error

Close closes the database.

func (Backend) GetIssuingGrantKeyInfo

func (e Backend) GetIssuingGrantKeyInfo(ctx context.Context, ia addr.IA,
	version scrypto.Version) (trust.KeyInfo, error)

func (Backend) GetRawChain

func (e Backend) GetRawChain(ctx context.Context, id trust.ChainID) ([]byte, error)

func (Backend) GetRawTRC

func (e Backend) GetRawTRC(ctx context.Context, id trust.TRCID) ([]byte, error)

func (Backend) GetTRC

func (e Backend) GetTRC(ctx context.Context, id trust.TRCID) (*trc.TRC, error)

func (Backend) GetTRCInfo

func (e Backend) GetTRCInfo(ctx context.Context, id trust.TRCID) (trust.TRCInfo, error)

func (Backend) InsertChain

func (e Backend) InsertChain(ctx context.Context, d decoded.Chain) (bool, bool, error)

func (Backend) InsertTRC

func (e Backend) InsertTRC(ctx context.Context, d decoded.TRC) (bool, 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.

func (Backend) TRCExists

func (e Backend) TRCExists(ctx context.Context, d decoded.TRC) (bool, error)

Jump to

Keyboard shortcuts

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