consensus

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAddressFromUrl added in v0.0.3

func GetAddressFromUrl(url string) string

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(msg *nats.Msg) error

Add2Engine Add a message to consensus engine

func (*ConsEngine) ConSequence added in v0.0.3

func (c *ConsEngine) ConSequence() bool

func (*ConsEngine) GetSequenceFromChain added in v0.0.3

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

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

func (*ConsEngine) SetSequence

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

SetSequence 设置交易序列号

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

func (*Ferry) GetSequenceFromChain added in v0.0.3

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

在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

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

Jump to

Keyboard shortcuts

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