msgcenter

package
v0.0.0-...-168a7d3 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultTrustedConfig = TrustedConfig{
	VotePercentage: 0.5,
	SuperNodeMin:   2,
	NodeTotalMin:   2,
}
View Source
var (
	ErrPublishedContentEmpty = errors.New("published content is empty")
)

Functions

func GetChannelTopics

func GetChannelTopics(chainID string, c MessageChannel) string

Types

type MessageCenter

type MessageCenter interface {
	Push(msg *pubsub.Message, prefix string)

	PublishMessage(pmsg proto.Message, topic string) error

	TrustMessage() <-chan interface{}

	Refresh()

	PowerOn(ctx context.Context, chainID string, ind *core.IpfsNode)
}

func NewCenter

func NewCenter(ind *core.IpfsNode, cvfs vdb.CVFS, cnf TrustedConfig, asd ASD.StatDaemon) MessageCenter

type MessageChannel

type MessageChannel string
const (
	Version                                  = "AyaMessageCenter V0.0.1"
	MessageChannelMiningBlock MessageChannel = "MiningBlock"
	MessageChannelMined       MessageChannel = "Mined"
	MessageChannelChainInfo   MessageChannel = "ChainInfo"
)

type ReviewMessage

type ReviewMessage struct {
	Content []byte

	Hash EComm.Hash

	Nodes []*im.Node

	MsgPrefix string
}

func NewReviewMessage

func NewReviewMessage(content []byte, sender *im.Node, prefix string, dfunc func(hash EComm.Hash)) *ReviewMessage

func (*ReviewMessage) AddConfirmNode

func (msg *ReviewMessage) AddConfirmNode(confirmer *im.Node)

func (*ReviewMessage) VoteInfo

func (msg *ReviewMessage) VoteInfo() (votes uint64, scount uint, ncount uint)

type TrustedConfig

type TrustedConfig struct {
	VotePercentage float32

	SuperNodeMin uint

	NodeTotalMin uint
}

Jump to

Keyboard shortcuts

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