repo

package
v0.0.0-...-9eca280 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoDB = errors.Validation.NewWithKeyAndDetail("ERR_NO_DB", "no db")
)

Functions

This section is empty.

Types

type BlobHashRepository

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

func NewBlobHashRepository

func NewBlobHashRepository(db DB) (*BlobHashRepository, error)

func (*BlobHashRepository) DeleteAllAfterBlockID

func (r *BlobHashRepository) DeleteAllAfterBlockID(blockID uint64) error

DeleteAllAfterBlockID is used when a reorg is detected

func (*BlobHashRepository) FirstByBlobHash

func (r *BlobHashRepository) FirstByBlobHash(blobHash string) (*blobstorage.BlobHash, error)

func (*BlobHashRepository) Save

type BlockMetaRepository

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

func NewBlockMetaRepository

func NewBlockMetaRepository(db DB) (*BlockMetaRepository, error)

func (*BlockMetaRepository) DeleteAllAfterBlockID

func (r *BlockMetaRepository) DeleteAllAfterBlockID(blockID uint64) error

DeleteAllAfterBlockID is used when a reorg is detected

func (*BlockMetaRepository) FindLatestBlockID

func (r *BlockMetaRepository) FindLatestBlockID() (uint64, error)

func (*BlockMetaRepository) Save

type DB

type DB interface {
	DB() (*sql.DB, error)
	GormDB() *gorm.DB
}

type DBTransaction

type DBTransaction interface {
	Begin() *DB
}

type Repositories

type Repositories struct {
	BlobHashRepo  *BlobHashRepository
	BlockMetaRepo *BlockMetaRepository
	// contains filtered or unexported fields
}

func NewRepositories

func NewRepositories(db DB) (*Repositories, error)

func (*Repositories) DeleteAllAfterBlockID

func (r *Repositories) DeleteAllAfterBlockID(ctx context.Context, blockID uint64) error

Database transaction to delete all blobs and blocks meta after a block id

func (*Repositories) SaveBlobAndBlockMeta

func (r *Repositories) SaveBlobAndBlockMeta(
	ctx context.Context,
	saveBlockMetaOpts *blobstorage.SaveBlockMetaOpts,
	saveBlobHashOpts *blobstorage.SaveBlobHashOpts,
) error

Database transaction to store blobs and blocks meta func (r *Repositories) SaveBlobAndBlockMeta(ctx context.Context, opts *blobstorage.SaveBlobAndBlockMetaOpts) error {

Jump to

Keyboard shortcuts

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