badger

package
v0.5.0-alpha.9 Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderContentPrefix = "hc"
)

Variables

This section is empty.

Functions

func DeliveredHashKey

func DeliveredHashKey(bh types.Hash) ds.Key

func DeliveredKey

func DeliveredKey(slot structs.Slot) ds.Key

func DeliveredNumKey

func DeliveredNumKey(bn uint64) ds.Key

func DeliveredPubkeyKey

func DeliveredPubkeyKey(pk types.PublicKey) ds.Key

func HeaderHashKey

func HeaderHashKey(bh types.Hash) ds.Key

func HeaderKeyContent

func HeaderKeyContent(slot uint64, blockHash string, builderHash string) ds.Key

func HeaderNumKey

func HeaderNumKey(bn uint64) ds.Key

Types

type DB

type DB interface {
	Get(context.Context, ds.Key) ([]byte, error)
}

type DBInter

type DBInter interface {
	View(func(txn *badger.Txn) error) error
	NewTransaction(bool) *badger.Txn
}

type Datastore

type Datastore struct {
	DB
	DBInter

	TTL time.Duration
}

func NewDatastore

func NewDatastore(t DB, d DBInter, ttl time.Duration) *Datastore

func (*Datastore) GetBuilderBlockSubmissions

func (s *Datastore) GetBuilderBlockSubmissions(ctx context.Context, headSlot uint64, query structs.SubmissionTraceQuery) (events []structs.BidTraceWithTimestamp, err error)

func (*Datastore) GetDeliveredPayloads

func (s *Datastore) GetDeliveredPayloads(ctx context.Context, headSlot uint64, query structs.PayloadTraceQuery) ([]structs.BidTraceExtended, error)

func (*Datastore) PutBuilderBlockSubmission

func (s *Datastore) PutBuilderBlockSubmission(ctx context.Context, bid structs.BidTraceWithTimestamp, isMostProfitable bool) (err error)

func (*Datastore) PutDelivered

func (s *Datastore) PutDelivered(ctx context.Context, slot structs.Slot, trace structs.DeliveredTrace, ttl time.Duration) error

Jump to

Keyboard shortcuts

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