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
- type Backend
- func (db *Backend) BeginTransaction(ctx context.Context, opts *sql.TxOptions) (trustdb.Transaction, error)
- func (db *Backend) Close() error
- func (e Backend) GetAllChains(ctx context.Context) (<-chan trustdb.ChainOrErr, error)
- func (e Backend) GetAllCustKeys(ctx context.Context) (<-chan trustdb.CustKeyOrErr, error)
- func (e Backend) GetAllIssCerts(ctx context.Context) (<-chan trustdb.CertOrErr, error)
- func (e Backend) GetAllTRCs(ctx context.Context) (<-chan trustdb.TrcOrErr, error)
- func (e Backend) GetChainMaxVersion(ctx context.Context, ia addr.IA) (*cert.Chain, error)
- func (e Backend) GetChainVersion(ctx context.Context, ia addr.IA, version scrypto.Version) (*cert.Chain, error)
- func (e Backend) GetCustKey(ctx context.Context, ia addr.IA) (*trustdb.CustKey, error)
- func (e Backend) GetIssCertMaxVersion(ctx context.Context, ia addr.IA) (*cert.Certificate, error)
- func (e Backend) GetIssCertVersion(ctx context.Context, ia addr.IA, version scrypto.Version) (*cert.Certificate, error)
- func (e Backend) GetLeafCertMaxVersion(ctx context.Context, ia addr.IA) (*cert.Certificate, error)
- func (e Backend) GetLeafCertVersion(ctx context.Context, ia addr.IA, version scrypto.Version) (*cert.Certificate, error)
- func (e Backend) GetTRCMaxVersion(ctx context.Context, isd addr.ISD) (*trc.TRC, error)
- func (e Backend) GetTRCVersion(ctx context.Context, isd addr.ISD, version scrypto.Version) (*trc.TRC, error)
- func (e Backend) InsertChain(ctx context.Context, chain *cert.Chain) (int64, error)
- func (e Backend) InsertCustKey(ctx context.Context, key *trustdb.CustKey, oldVersion scrypto.Version) error
- func (e Backend) InsertIssCert(ctx context.Context, crt *cert.Certificate) (int64, error)
- func (e Backend) InsertLeafCert(ctx context.Context, crt *cert.Certificate) (int64, error)
- func (e Backend) InsertTRC(ctx context.Context, trcobj *trc.TRC) (int64, error)
- func (db *Backend) SetMaxIdleConns(maxIdleConns int)
- func (db *Backend) SetMaxOpenConns(maxOpenConns int)
Constants ¶
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 (*Backend) BeginTransaction ¶
func (db *Backend) BeginTransaction(ctx context.Context, opts *sql.TxOptions) (trustdb.Transaction, error)
BeginTransaction starts a new transaction.
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 (Backend) GetAllTRCs ¶
GetAllTRCs fetches all TRCs from the database.
func (Backend) GetChainMaxVersion ¶
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 ¶
GetCustKey gets the latest signing key and version for the specified customer AS.
func (Backend) GetIssCertMaxVersion ¶
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 ¶
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 ¶
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 ¶
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 ¶
InsertIssCert inserts the issuer certificate.
func (Backend) InsertLeafCert ¶
InsertLeafCert inserts the leaf certificate.
func (Backend) InsertTRC ¶
InsertTRC inserts trcobj into the database. The first return value is the number of rows affected.