backend

package
v0.0.0-...-8ad0a2a Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: GPL-3.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByRaftId

type ByRaftId []raft.Address

func (ByRaftId) Len

func (a ByRaftId) Len() int

func (ByRaftId) Less

func (a ByRaftId) Less(i, j int) bool

func (ByRaftId) Swap

func (a ByRaftId) Swap(i, j int)

type ProtocolManager

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

func NewProtocolManager

func NewProtocolManager(raftId uint16, raftPort uint16, blockchain *core.BlockChain, mux *event.TypeMux, bootstrapNodes []*enode.Node, joinExisting bool, datadir string, minter *miner.Miner, downloader *downloader.Downloader) (*ProtocolManager, error)

func (*ProtocolManager) FetchRaftId

func (pm *ProtocolManager) FetchRaftId(enodeId string) (uint16, error)

Returns the raft id for a given enodeId

func (*ProtocolManager) IsIDRemoved

func (pm *ProtocolManager) IsIDRemoved(id uint64) bool

func (*ProtocolManager) LeaderAddress

func (pm *ProtocolManager) LeaderAddress() (*raft.Address, error)

The Address for the current leader, or an error if no leader is elected.

func (*ProtocolManager) MaxRaftId

func (pm *ProtocolManager) MaxRaftId() uint16

func (*ProtocolManager) NodeInfo

func (pm *ProtocolManager) NodeInfo() *RaftNodeInfo

func (*ProtocolManager) Process

func (pm *ProtocolManager) Process(ctx context.Context, m raftpb.Message) error

func (*ProtocolManager) ProposeNewPeer

func (pm *ProtocolManager) ProposeNewPeer(enodeId string, raftId uint16) (uint16, error)

func (*ProtocolManager) ProposePeerRemoval

func (pm *ProtocolManager) ProposePeerRemoval(raftId uint16)

func (*ProtocolManager) ReportSnapshot

func (pm *ProtocolManager) ReportSnapshot(id uint64, status etcdRaft.SnapshotStatus)

func (*ProtocolManager) ReportUnreachable

func (pm *ProtocolManager) ReportUnreachable(id uint64)

func (*ProtocolManager) Start

func (pm *ProtocolManager) Start(p2pServer *p2p.Server)

func (*ProtocolManager) Stop

func (pm *ProtocolManager) Stop()

func (*ProtocolManager) WriteMsg

func (pm *ProtocolManager) WriteMsg(msg p2p.Msg) error

type PublicRaftAPI

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

func NewPublicRaftAPI

func NewPublicRaftAPI(raftService *RaftService) *PublicRaftAPI

func (*PublicRaftAPI) Cluster

func (s *PublicRaftAPI) Cluster() []*raft.Address

func (*PublicRaftAPI) GetMaxRaftId

func (s *PublicRaftAPI) GetMaxRaftId() uint16

func (*PublicRaftAPI) GetRaftId

func (s *PublicRaftAPI) GetRaftId(enodeId string) (uint16, error)

func (*PublicRaftAPI) Leader

func (s *PublicRaftAPI) Leader() (string, error)

func (*PublicRaftAPI) Role

func (s *PublicRaftAPI) Role() string

type RaftNodeInfo

type RaftNodeInfo struct {
	ClusterSize    int             `json:"clusterSize"`
	Role           string          `json:"role"`
	Address        *raft.Address   `json:"address"`
	PeerAddresses  []*raft.Address `json:"peerAddresses"`
	RemovedPeerIds []uint16        `json:"removedPeerIds"`
	AppliedIndex   uint64          `json:"appliedIndex"`
	SnapshotIndex  uint64          `json:"snapshotIndex"`
}

type RaftService

type RaftService struct {
	RaftProtocolManager *ProtocolManager
	// contains filtered or unexported fields
}

func New

func New(ctx *node.ServiceContext, raftId, raftPort uint16, joinExisting bool, e *eth.SimpleService, startPeers []*enode.Node, datadir string) (*RaftService, error)

func (*RaftService) APIs

func (service *RaftService) APIs() []rpc.API

func (*RaftService) AccountManager

func (service *RaftService) AccountManager() *accounts.Manager

func (*RaftService) BlockChain

func (service *RaftService) BlockChain() *core.BlockChain

func (*RaftService) ChainDb

func (service *RaftService) ChainDb() ethdb.Database

func (*RaftService) EventMux

func (service *RaftService) EventMux() *event.TypeMux

func (*RaftService) Protocols

func (service *RaftService) Protocols() []p2p.Protocol

func (*RaftService) Start

func (service *RaftService) Start(p2pServer *p2p.Server) error

Start implements node.Service, starting the background data propagation thread of the protocol.

func (*RaftService) Stop

func (service *RaftService) Stop() error

Stop implements node.Service, stopping the background data propagation thread of the protocol.

func (*RaftService) TxPool

func (service *RaftService) TxPool() *core.TxPool

type Snapshot

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

func (*Snapshot) DecodeRLP

func (snapshot *Snapshot) DecodeRLP(s *rlp.Stream) error

func (*Snapshot) EncodeRLP

func (snapshot *Snapshot) EncodeRLP(w io.Writer) error

Jump to

Keyboard shortcuts

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