merge

package
v0.8.8 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2017 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDurationCnt      = 5 * time.Second
	DefaultStoreCntDuration = 20 * time.Second
)

DefaultDurationCnt default timeout

View Source
const SEPARATOR = "|"

SEPARATOR separates fromChain from toChain

Variables

This section is empty.

Functions

This section is empty.

Types

type AckMergeTxEvent

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

AckMergeTxEvent for ack merge msg

type AckMergedTxEvent

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

AckMergedTxEvent for ack merged msg

type BroadcastAckMergeTxEvent

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

BroadcastAckMergeTxEvent for broadcast ack merge msg to local peers

type ChainCacheTable

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

ChainCacheTable manage all tables for sub-chain

func NewChainCacheTable

func NewChainCacheTable(table string) *ChainCacheTable

NewChainCacheTable create instance

func SetChainTable

func SetChainTable(table string, callback func(peerTx *PeerTx)) *ChainCacheTable

SetChainTable table == chainID

func (*ChainCacheTable) AddMergeTxs

func (cct *ChainCacheTable) AddMergeTxs(chainID, peerID string, upload *UploadPayload)

AddMergeTxs send peerTx when get the agreement transaction from all sub-peers delete txHash-count from cct.countDot when get the agreement transaction delete the cache item(peerID+txHash) when timeout = duration * DEFAULT_DURATION_CNT

type Config

type Config struct {
	MaxPeers      int
	MergeDuration time.Duration
	ChainID       string
	PeerID        string
}

Config merge config struct

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns default merge config

type CountDot

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

CountDot store the count and flag of transaction

func NewCountDot

func NewCountDot() *CountDot

NewCountDot create instance

type Event

type Event interface{}

Event merge event

type Helper

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

Helper manages merge service

func NewHelper

func NewHelper(ledger *ledger.Ledger, bc *blockchain.Blockchain, pmSender pmHandler, mergeConfig *Config) *Helper

NewHelper create instance

func (*Helper) HandleLocalMsg

func (h *Helper) HandleLocalMsg(event Event)

HandleLocalMsg handle msg from local peers

func (*Helper) HandleNetMsg

func (h *Helper) HandleNetMsg(msgType uint8, chainID string, peerID string, event Event)

HandleNetMsg handle msg from msg_net

func (*Helper) ProcessEvent

func (h *Helper) ProcessEvent(event Event)

ProcessEvent broadcast msg to peers or msg_net

func (*Helper) Start

func (h *Helper) Start()

Start starts service

type PeerTx

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

PeerTx for where the transaction should be delivered

type Receiver

type Receiver interface {
	ProcessEvent(e Event)
}

Receiver for processing the event

type TxEvent

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

TxEvent for merge txs msg

type TxMerge

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

TxMerge merge transactions

func NewTxMerge

func NewTxMerge(ledger *ledger.Ledger) *TxMerge

NewTxMerge initialization

type TxParser

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

TxParser for parse tx

func NewTxParser

func NewTxParser(bc *blockchain.Blockchain) *TxParser

NewTxParser create txParser instance

type UploadPayload

type UploadPayload struct {
	PeerNum        uint32
	MergeDuration  uint32
	RepeatMergeTxs types.Transactions
	MergeTxs       types.Transactions
}

UploadPayload data to upload

func NewUploadPayload

func NewUploadPayload(peerNum, mergeDutation uint32, repeatMergeTxs, mergeTxs types.Transactions) *UploadPayload

NewUploadPayload returns a UploadPayload instance

func (*UploadPayload) Deserialize

func (up *UploadPayload) Deserialize(data []byte) error

Deserialize deserializes updatePayload

func (*UploadPayload) Serialize

func (up *UploadPayload) Serialize() []byte

Serialize serializes updatePayload

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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