trustdbsqlite

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: 13 Imported by: 0

Documentation

Overview

Package trustdbsqlite implements the trustdb interface with a sqlite backed DB.

KNOWN ISSUE: DB methods serialize to/dezerialize from JSON on each call. For performance penalty details, check the benchmarks in the test file.

Index

Constants

View Source
const (
	Path          = "trustDB.sqlite3"
	SchemaVersion = 2
	Schema        = `` /* 1139-byte string literal not displayed */

	TRCsTable        = "TRCs"
	ChainsTable      = "Chains"
	IssuerCertsTable = "IssuerCerts"
	LeafCertsTable   = "LeafCerts"
	CustKeysTable    = "CustKeys"
	CustKeysLogTable = "CustKeysLog"
)

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)

func (*Backend) BeginTransaction

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

BeginTransaction starts a new transaction.

func (*Backend) Close

func (db *Backend) Close() error

Close closes the database connection.

func (Backend) GetAllChains

func (e Backend) GetAllChains(ctx context.Context) (<-chan trustdb.ChainOrErr, error)

func (Backend) GetAllCustKeys

func (e Backend) GetAllCustKeys(ctx context.Context) (<-chan trustdb.CustKeyOrErr, error)

func (Backend) GetAllIssCerts

func (e Backend) GetAllIssCerts(ctx context.Context) (<-chan trustdb.CertOrErr, error)

func (Backend) GetAllTRCs

func (e Backend) GetAllTRCs(ctx context.Context) (<-chan trustdb.TrcOrErr, error)

GetAllTRCs fetches all TRCs from the database.

func (Backend) GetChainMaxVersion

func (e Backend) GetChainMaxVersion(ctx context.Context, ia addr.IA) (*cert.Chain, error)

GetChainMaxVersion returns the max version of the chain for ia.

func (Backend) GetChainVersion

func (e Backend) GetChainVersion(ctx context.Context, ia addr.IA,
	version scrypto.Version) (*cert.Chain, error)

GetChainVersion returns the specified version of the certificate chain for ia. If version is scrypto.LatestVer, this is equivalent to GetChainMaxVersion.

func (Backend) GetCustKey

func (e Backend) GetCustKey(ctx context.Context, ia addr.IA) (*trustdb.CustKey, error)

GetCustKey gets the latest signing key and version for the specified customer AS.

func (Backend) GetIssCertMaxVersion

func (e Backend) GetIssCertMaxVersion(ctx context.Context,
	ia addr.IA) (*cert.Certificate, error)

GetIssCertMaxVersion returns the max version of the issuer certificate for ia.

func (Backend) GetIssCertVersion

func (e Backend) GetIssCertVersion(ctx context.Context, ia addr.IA,
	version scrypto.Version) (*cert.Certificate, error)

GetIssCertVersion returns the specified version of the issuer certificate for ia. If version is scrypto.LatestVer, this is equivalent to GetIssCertMaxVersion.

func (Backend) GetLeafCertMaxVersion

func (e Backend) GetLeafCertMaxVersion(ctx context.Context,
	ia addr.IA) (*cert.Certificate, error)

GetLeafCertMaxVersion returns the max version of the leaf certificate for ia.

func (Backend) GetLeafCertVersion

func (e Backend) GetLeafCertVersion(ctx context.Context, ia addr.IA,
	version scrypto.Version) (*cert.Certificate, error)

GetLeafCertVersion returns the specified version of the leaf certificate for ia. If version is scrypto.LatestVer, this is equivalent to GetLeafCertMaxVersion.

func (Backend) GetTRCMaxVersion

func (e Backend) GetTRCMaxVersion(ctx context.Context, isd addr.ISD) (*trc.TRC, error)

GetTRCMaxVersion returns the max version of the TRC for ia.

func (Backend) GetTRCVersion

func (e Backend) GetTRCVersion(ctx context.Context,
	isd addr.ISD, version scrypto.Version) (*trc.TRC, error)

GetTRCVersion returns the specified version of the TRC for isd. If version is scrypto.LatestVer, this is equivalent to GetTRCMaxVersion.

func (Backend) InsertChain

func (e Backend) InsertChain(ctx context.Context, chain *cert.Chain) (int64, error)

InsertChain inserts chain into the database. The first return value is the number of rows affected.

func (Backend) InsertCustKey

func (e Backend) InsertCustKey(ctx context.Context,
	key *trustdb.CustKey, oldVersion scrypto.Version) error

InsertCustKey implements trustdb.InsertCustKey.

func (Backend) InsertIssCert

func (e Backend) InsertIssCert(ctx context.Context, crt *cert.Certificate) (int64, error)

InsertIssCert inserts the issuer certificate.

func (Backend) InsertLeafCert

func (e Backend) InsertLeafCert(ctx context.Context, crt *cert.Certificate) (int64, error)

InsertLeafCert inserts the leaf certificate.

func (Backend) InsertTRC

func (e Backend) InsertTRC(ctx context.Context, trcobj *trc.TRC) (int64, error)

InsertTRC inserts trcobj into the database. The first return value is the number of rows affected.

func (*Backend) SetMaxIdleConns

func (db *Backend) SetMaxIdleConns(maxIdleConns int)

func (*Backend) SetMaxOpenConns

func (db *Backend) SetMaxOpenConns(maxOpenConns int)

Jump to

Keyboard shortcuts

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