dbstorage

package
v0.5.0-beta3 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBStorage

type DBStorage struct {
	DB *sql.DB
}

DBStorage implements the Storage interface

func NewDBStorage

func NewDBStorage(dbPath string) (*DBStorage, error)

NewDBStorage creates a new DBStorage instance

func (*DBStorage) AddGeneratedProof

func (d *DBStorage) AddGeneratedProof(ctx context.Context, proof *state.Proof, dbTx db.Txer) error

AddGeneratedProof adds a generated proof to the storage

func (*DBStorage) AddSequence

func (d *DBStorage) AddSequence(ctx context.Context, sequence state.Sequence, dbTx db.Txer) error

AddSequence stores the sequence information to allow the aggregator verify sequences.

func (*DBStorage) BeginTx

func (d *DBStorage) BeginTx(ctx context.Context, options *sql.TxOptions) (db.Txer, error)

func (*DBStorage) CheckProofContainsCompleteSequences

func (d *DBStorage) CheckProofContainsCompleteSequences(
	ctx context.Context, proof *state.Proof, dbTx db.Txer,
) (bool, error)

CheckProofContainsCompleteSequences checks if a recursive proof contains complete sequences

func (*DBStorage) CheckProofExistsForBatch

func (d *DBStorage) CheckProofExistsForBatch(ctx context.Context, batchNumber uint64, dbTx db.Txer) (bool, error)

CheckProofExistsForBatch checks if the batch is already included in any proof

func (*DBStorage) CleanupGeneratedProofs

func (d *DBStorage) CleanupGeneratedProofs(ctx context.Context, batchNumber uint64, dbTx db.Txer) error

CleanupGeneratedProofs deletes from the storage the generated proofs up to the specified batch number included.

func (*DBStorage) CleanupLockedProofs

func (d *DBStorage) CleanupLockedProofs(ctx context.Context, duration string, dbTx db.Txer) (int64, error)

CleanupLockedProofs deletes from the storage the proofs locked in generating state for more than the provided threshold.

func (*DBStorage) DeleteGeneratedProofs

func (d *DBStorage) DeleteGeneratedProofs(
	ctx context.Context, batchNumber uint64, batchNumberFinal uint64, dbTx db.Txer,
) error

DeleteGeneratedProofs deletes from the storage the generated proofs falling inside the batch numbers range.

func (*DBStorage) DeleteUngeneratedProofs

func (d *DBStorage) DeleteUngeneratedProofs(ctx context.Context, dbTx db.Txer) error

DeleteUngeneratedProofs deletes ungenerated proofs. This method is meant to be use during aggregator boot-up sequence

func (*DBStorage) GetProofReadyToVerify

func (d *DBStorage) GetProofReadyToVerify(
	ctx context.Context, lastVerfiedBatchNumber uint64, dbTx db.Txer,
) (*state.Proof, error)

GetProofReadyToVerify return the proof that is ready to verify

func (*DBStorage) GetProofsToAggregate

func (d *DBStorage) GetProofsToAggregate(ctx context.Context, dbTx db.Txer) (*state.Proof, *state.Proof, error)

GetProofsToAggregate return the next to proof that it is possible to aggregate

func (*DBStorage) UpdateGeneratedProof

func (d *DBStorage) UpdateGeneratedProof(ctx context.Context, proof *state.Proof, dbTx db.Txer) error

UpdateGeneratedProof updates a generated proof in the storage

Jump to

Keyboard shortcuts

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