treedb

package
v0.20261006.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIssuanceLogNotInitialized = errors.New("issuance log DB not initialized")

Functions

This section is empty.

Types

type CheckpointModel

type CheckpointModel struct {
	ID              int64   `db:"id"`
	MTCLogID        string  `db:"mtcLogID"`
	MTCASignature   []byte  `db:"mtcaSignature"`
	MirrorID        *string `db:"mirrorID"`
	MirrorSignature []byte  `db:"mirrorSignature"`
	TreeSize        int64   `db:"treeSize"`
	RootHash        []byte  `db:"rootHash"`
	SubtreeID1      *int64  `db:"subtreeID1"`
	SubtreeID2      *int64  `db:"subtreeID2"`
}

CheckpointModel represents the database storage of a checkpoint and associated signatures.

For signing, the TreeSize and RootHash fields are incorporated into a `cosigned.Message`.

func (*CheckpointModel) Mirrored

func (c *CheckpointModel) Mirrored() bool

func (*CheckpointModel) Valid

func (c *CheckpointModel) Valid() error

type CheckpointSubtreeModel added in v0.20261006.0

type CheckpointSubtreeModel struct {
	ID              int64   `db:"id"`
	MTCLogID        string  `db:"mtcLogID"`
	MTCASignature   []byte  `db:"mtcaSignature"`
	MirrorID        *string `db:"mirrorID"`
	MirrorSignature []byte  `db:"mirrorSignature"`
	SubtreeStart    uint64  `db:"subtreeStart"`
	SubtreeEnd      uint64  `db:"subtreeEnd"`
	SubtreeHash     []byte  `db:"subtreeHash"`
}

func (*CheckpointSubtreeModel) Mirrored added in v0.20261006.0

func (s *CheckpointSubtreeModel) Mirrored() bool

func (*CheckpointSubtreeModel) Valid added in v0.20261006.0

func (s *CheckpointSubtreeModel) Valid() error

type Impl

type Impl struct {
	// contains filtered or unexported fields
}

func New

func New(dbMap *db.WrappedMap) *Impl

New returns an `*Impl` object that uses the given *db.WrappedMap. As a side effect, it registers table mappings with borp.

func (*Impl) AddMirrorSignature

func (i *Impl) AddMirrorSignature(ctx context.Context, id int64, mirrorID string, mirrorCosig []byte, mtcLogID string) error

func (*Impl) GetCheckpointSubtree added in v0.20261006.0

func (i *Impl) GetCheckpointSubtree(ctx context.Context, mtcLogID string, id int64) (*CheckpointSubtreeModel, error)

func (*Impl) InsertCheckpoint added in v0.20261006.0

func (i *Impl) InsertCheckpoint(ctx context.Context, c *CheckpointModel) error

InsertCheckpoint inserts the given CheckpointModel into the database.

It modifies its parameter's ID field to set the newly allocated autoincrement ID.

func (*Impl) InsertCheckpointSubtree added in v0.20261006.0

func (i *Impl) InsertCheckpointSubtree(ctx context.Context, model *CheckpointSubtreeModel) (int64, error)

InsertCheckpointSubtree inserts a row into db, and returns the inserted row ID, or an error. Because borp's `Insert` modifies its argument to set the ID when a field is marked as autoincrement (`.SetKeys(true, "ID")`), this method also modifies its argument (in this case, `model`).

func (*Impl) LatestCheckpoint

func (i *Impl) LatestCheckpoint(ctx context.Context, mtcLogID string) (*CheckpointModel, error)

func (*Impl) WithTransaction added in v0.20261006.0

func (i *Impl) WithTransaction(ctx context.Context, f db.TxFunc) (any, error)

WithTransaction calls `github.com/letsencrypt/boulder/db.WithTransaction` for the given transaction function, with the built-in DB. In the database-backed implementation this is simply a pass-through.

TODO(#8998): Replace TxFunc's `db.Executor` parameter with an interface that defines the operations we want to perform inside a transaction, so we can mock those.

Jump to

Keyboard shortcuts

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