consensus

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAddress added in v0.1.0

func GetAddress(url string) string

GetAddress returns address

func StartQcpConsume added in v0.1.0

func StartQcpConsume(conf *config.Config) (err error)

StartQcpConsume Start to consume tx msg

Types

type ConsEngine

type ConsEngine struct {
	M *EngineMap
	F *Ferry
	// contains filtered or unexported fields
}

ConsEngine Consensus engine

func NewConsEngine

func NewConsEngine(from, to string) *ConsEngine

NewConsEngine New a consensus engine

func (*ConsEngine) Add2Engine

func (c *ConsEngine) Add2Engine(data []byte) error

Add2Engine Add a message to consensus engine

func (*ConsEngine) GetSequenceFromChain added in v0.0.3

func (c *ConsEngine) GetSequenceFromChain(from, to, inout string) (int64, error)

GetSequenceFromChain 在to chain上查询 来自/要去 from chain 的 sequence

func (*ConsEngine) Getfrom added in v0.1.0

func (c *ConsEngine) Getfrom() string

Getfrom return from value

func (*ConsEngine) Getto added in v0.1.0

func (c *ConsEngine) Getto() string

Getto returns to value

func (*ConsEngine) RoomKeeper added in v0.1.0

func (c *ConsEngine) RoomKeeper()

RoomKeeper 清理 EngineMap,ConsensusMap过时k-v;校正sequence

func (*ConsEngine) SetSequence

func (c *ConsEngine) SetSequence(from, to string, s int64)

SetSequence 设置交易序列号

func (*ConsEngine) Setfrom added in v0.1.0

func (c *ConsEngine) Setfrom(from string)

Setfrom set from value

func (*ConsEngine) Setto added in v0.1.0

func (c *ConsEngine) Setto(to string)

Setto set to value

func (*ConsEngine) StartEngine

func (c *ConsEngine) StartEngine() error

StartEngine 启动共识引擎尝试处理下一个交易

type Consensus added in v0.0.3

type Consensus struct {
	Sequence int64
	Hash     string
	Nodes    string
}

type ConsensusMap added in v0.0.3

type ConsensusMap struct {
	ConsMap map[int64]map[string]string
	// contains filtered or unexported fields
}

func (*ConsensusMap) AddConsToMap added in v0.0.3

func (c *ConsensusMap) AddConsToMap(sequence int64, hash, nodes string) error

func (*ConsensusMap) GetConsFromMap added in v0.0.3

func (c *ConsensusMap) GetConsFromMap(sequence int64) (*Consensus, error)

type EngineMap added in v0.0.3

type EngineMap struct {
	MsgMap map[int64]map[string]string
	// contains filtered or unexported fields
}

func (*EngineMap) AddMsgToMap added in v0.0.3

func (m *EngineMap) AddMsgToMap(f *Ferry, event types.Event, N int) (sequence int64, err error)

type Ferry

type Ferry struct {
	ConsMap *ConsensusMap
	// contains filtered or unexported fields
}

Ferry Comsumer tx message and handle(consensus, broadcast...) it.

func NewFerry added in v0.0.3

func NewFerry(conf *config.Config, from, to string, sequence int64) *Ferry

NewFerry new a ferry for relaying transactions

func (*Ferry) GetSequenceFromChain added in v0.0.3

func (f *Ferry) GetSequenceFromChain(from, to, inout string) (int64, error)

GetSequenceFromChain 在to chain上查询 来自/要去 from chain 的 sequence

func (*Ferry) SetSequence added in v0.0.3

func (f *Ferry) SetSequence(from, to string, s int64)

SetSequence 设置交易序列号

func (*Ferry) StartFerry added in v0.0.3

func (f *Ferry) StartFerry() error

StartFerry 启动共识引擎尝试处理下一个交易

Jump to

Keyboard shortcuts

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