synchronise

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CrossChain

type CrossChain interface {
	CanAcceptTxs() bool
	RequireSignatures() int
	GetConfirmedTransactionNumberOnChain(trigger.Transaction) uint64
}

type CrossPool

type CrossPool interface {
	AddRemotes([]*cc.CrossTransaction) ([]common.Address, []error)
	Pending(startNumber uint64, limit int) (ids []common.Hash, pending []*cc.CrossTransactionWithSignatures)
}

type CrossStore

type CrossStore interface {
	Height() uint64
	Writes([]*cc.CrossTransactionWithSignatures, bool) error
}

type Peer

type Peer interface {
	RequestCtxSyncByHeight(chainID uint64, height uint64) error
	RequestPendingSync(chain uint64, ids []common.Hash) error
	HasCrossTransaction(hash common.Hash) bool
}

type SortedTxByBlockNum

type SortedTxByBlockNum []*core.CrossTransactionWithSignatures

func (SortedTxByBlockNum) LastNumber

func (s SortedTxByBlockNum) LastNumber() uint64

func (SortedTxByBlockNum) Len

func (s SortedTxByBlockNum) Len() int

func (SortedTxByBlockNum) Less

func (s SortedTxByBlockNum) Less(i, j int) bool

func (SortedTxByBlockNum) Swap

func (s SortedTxByBlockNum) Swap(i, j int)

type Sync

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

func New

func New(chainID *big.Int, pool CrossPool, store CrossStore, chain CrossChain, mode SyncMode) *Sync

func (*Sync) DeliverCrossTransactions

func (s *Sync) DeliverCrossTransactions(pid string, ctxList []*cc.CrossTransactionWithSignatures) error

func (*Sync) DeliverPending

func (s *Sync) DeliverPending(pid string, pending []*cc.CrossTransaction) error

func (*Sync) RegisterPeer

func (s *Sync) RegisterPeer(id string, peer Peer) error

func (*Sync) Synchronise

func (s *Sync) Synchronise(id string, height *big.Int) error

func (*Sync) SynchronisePending

func (s *Sync) SynchronisePending(id string) error

func (*Sync) Terminate

func (s *Sync) Terminate()

func (*Sync) UnregisterPeer

func (s *Sync) UnregisterPeer(id string) error

type SyncMode

type SyncMode uint8
const (
	ALL SyncMode = iota
	STORE
	PENDING
	OFF
)

func (SyncMode) MarshalText

func (mode SyncMode) MarshalText() ([]byte, error)

func (SyncMode) String

func (mode SyncMode) String() string

func (*SyncMode) UnmarshalText

func (mode *SyncMode) UnmarshalText(text []byte) error

type SyncPendingReq

type SyncPendingReq struct {
	Chain uint64
	Ids   []common.Hash
}

type SyncPendingResp

type SyncPendingResp struct {
	Chain uint64
	Data  [][]byte
}

type SyncReq

type SyncReq struct {
	Chain  uint64
	Height uint64
}

type SyncResp

type SyncResp struct {
	Chain uint64
	Data  [][]byte
}

Jump to

Keyboard shortcuts

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