store

package
v1.9.4 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("key not found")
)

Functions

func GetKey

func GetKey(keys []string) []byte

Types

type BlockStore

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

func NewBlockStore

func NewBlockStore(db Store, prefix string) *BlockStore

func (*BlockStore) Decode

func (ms *BlockStore) Decode(data []byte, output interface{}) error

func (*BlockStore) Encode

func (ms *BlockStore) Encode(d interface{}) ([]byte, error)

func (*BlockStore) GetKey

func (bs *BlockStore) GetKey(nId string) []byte

func (*BlockStore) GetLastStoredBlock

func (bs *BlockStore) GetLastStoredBlock(nId string) (uint64, error)

GetLastStoredBlock queries the blockstore and returns latest known block

func (*BlockStore) StoreBlock

func (bs *BlockStore) StoreBlock(height uint64, nId string) error

StoreBlock stores block number per domainID into blockstore

type FinalityStore

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

func NewFinalityStore

func NewFinalityStore(db Store, prefix string) *FinalityStore

func (*FinalityStore) Decode

func (ms *FinalityStore) Decode(data []byte, output interface{}) error

func (*FinalityStore) DeleteTxObject

func (ms *FinalityStore) DeleteTxObject(messageKey *types.MessageKey) error

func (*FinalityStore) Encode

func (ms *FinalityStore) Encode(d interface{}) ([]byte, error)

func (*FinalityStore) GetTxObject

func (ms *FinalityStore) GetTxObject(messageKey *types.MessageKey) (*types.TransactionObject, error)

func (*FinalityStore) GetTxObjects

func (ms *FinalityStore) GetTxObjects(nId string, p *Pagination) ([]*types.TransactionObject, error)

func (*FinalityStore) StoreTxObject

func (ms *FinalityStore) StoreTxObject(message *types.TransactionObject) error

message will be stored based on destination nId

func (*FinalityStore) TotalCount

func (ms *FinalityStore) TotalCount() (uint64, error)

func (*FinalityStore) TotalCountByChain

func (ms *FinalityStore) TotalCountByChain(nId string) (uint64, error)

type KeyValueReader

type KeyValueReader interface {
	GetByKey(key []byte) ([]byte, error)
}

type KeyValueWriter

type KeyValueWriter interface {
	SetByKey(key []byte, value []byte) error
}

type LastProcessedTxStore added in v1.6.0

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

func NewLastProcessedTxStore added in v1.6.0

func NewLastProcessedTxStore(db Store, prefix string) *LastProcessedTxStore

func (*LastProcessedTxStore) Get added in v1.6.0

func (s *LastProcessedTxStore) Get(nId string) ([]byte, error)

func (*LastProcessedTxStore) Set added in v1.6.0

func (s *LastProcessedTxStore) Set(nId string, txInfo []byte) error

type MessageStore

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

func NewMessageStore

func NewMessageStore(db Store, prefix string) *MessageStore

func (*MessageStore) Decode

func (ms *MessageStore) Decode(data []byte, output interface{}) error

func (*MessageStore) DeleteMessage

func (ms *MessageStore) DeleteMessage(messageKey *types.MessageKey) error

func (*MessageStore) Encode

func (ms *MessageStore) Encode(d interface{}) ([]byte, error)

func (*MessageStore) GetMessage

func (ms *MessageStore) GetMessage(messageKey *types.MessageKey) (*types.RouteMessage, error)

func (*MessageStore) GetMessages

func (ms *MessageStore) GetMessages(nId string, p *Pagination) ([]*types.RouteMessage, error)

func (*MessageStore) StoreMessage

func (ms *MessageStore) StoreMessage(message *types.RouteMessage) error

func (*MessageStore) TotalCount

func (ms *MessageStore) TotalCount() (uint, error)

func (*MessageStore) TotalCountByChain

func (ms *MessageStore) TotalCountByChain(nId string) (uint, error)

type Pagination

type Pagination struct {
	Limit  uint
	Offset uint
	All    bool
}

func NewPagination

func NewPagination() *Pagination

func (*Pagination) CalculateOffset

func (p *Pagination) CalculateOffset(page uint) uint

CalculateOffset calculates the offset based on the page and limit

func (*Pagination) CalculateTotalPages

func (p *Pagination) CalculateTotalPages(total int) uint

CalculateTotalPages calculates the total pages based on the limit and total count

func (*Pagination) GetAll

func (p *Pagination) GetAll() *Pagination

func (*Pagination) WithLimit

func (p *Pagination) WithLimit(l uint) *Pagination

func (*Pagination) WithOffset

func (p *Pagination) WithOffset(o uint) *Pagination

func (*Pagination) WithPage

func (p *Pagination) WithPage(page, limit uint) *Pagination

WithPage sets the page and calculates the offset

type Store

type Store interface {
	KeyValueReader
	KeyValueWriter
	NewIterator(prefix []byte) iterator.Iterator
	ClearStore() error
	DeleteByKey(key []byte) error
}

Jump to

Keyboard shortcuts

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