daemons

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MonitorDaemonCh is monitor daemon channel
	MonitorDaemonCh = make(chan []string, 100)
	NtpDriftFlag    = false
)
View Source
var SigChan chan os.Signal

SigChan is a channel

Functions

func BlockGenerator

func BlockGenerator(ctx context.Context, d *daemon) error

BlockGenerator is daemon that generates blocks

func BlockGeneratorCandidate

func BlockGeneratorCandidate(ctx context.Context, d *daemon) error

func BlocksCollection

func BlocksCollection(ctx context.Context, d *daemon) error

BlocksCollection collects and parses blocks

func CandidateNodeVoting

func CandidateNodeVoting(ctx context.Context, d *daemon) error

func CheckDB

func CheckDB() bool

CheckDB check if installation complete or not

func Confirmations

func Confirmations(ctx context.Context, d *daemon) error

Confirmations gets and checks blocks from nodes Getting amount of nodes, which has the same hash as we do

func DBLock

func DBLock()

DBLock locks daemons

func DBUnlock

func DBUnlock()

DBUnlock unlocks database

func Disseminator

func Disseminator(ctx context.Context, d *daemon) error

Disseminator is send to all nodes from nodes_connections the following data if we are honor node: sends blocks and transactions hashes else send the full transactions

func ExternalNetwork

func ExternalNetwork(ctx context.Context, d *daemon) error

ExternalNetwork sends txinfo to the external network

func GetCandidateNodePositionByPublicKey

func GetCandidateNodePositionByPublicKey() (int64, error)

func GetCandidateNodes

func GetCandidateNodes() (sqldb.CandidateNodes, error)

func GetRemoteGoodHosts

func GetRemoteGoodHosts() ([]string, error)

func GetThisNodePosition

func GetThisNodePosition(candidateNodes sqldb.CandidateNodes, prevBlock *sqldb.InfoBlock) (sqldb.CandidateNode, bool)

func InitialLoad

func InitialLoad(logger *log.Entry) error

func IsReachable

func IsReachable(host string, blockID int64, ch0 chan string, logger *log.Entry)

IsReachable checks if there is blockID on the host

func Monitoring

func Monitoring(w http.ResponseWriter, r *http.Request)

Monitoring starts monitoring

func Ntp_Work

func Ntp_Work(ctx context.Context)

ntp

func QueueParserBlocks

func QueueParserBlocks(ctx context.Context, d *daemon) error

QueueParserBlocks parses and applies blocks from the queue

func QueueParserTx

func QueueParserTx(ctx context.Context, d *daemon) error

QueueParserTx parses transaction from the queue

func ReplaceBlocksFromHost

func ReplaceBlocksFromHost(ctx context.Context, host string, blockID, replaceCount int64) error

ReplaceBlocksFromHost replaces blockchain received from the host. Number (replaceCount) of blocks starting from blockID will be re-played.

func Scheduler

func Scheduler(ctx context.Context, d *daemon) error

Scheduler starts contracts on schedule

func SendExternalTransaction

func SendExternalTransaction() error

func StartDaemons

func StartDaemons(ctx context.Context, daemonsToStart []string)

StartDaemons starts daemons

func ToBroadcastNodeConnInfo

func ToBroadcastNodeConnInfo(votingTotal VotingTotal, tcpAddress string, logger *log.Entry) error

func ToUpdateMachineStatus

func ToUpdateMachineStatus(currentTcpAddress, tcpAddress string, ch chan map[string]VotingRes, logger *log.Entry) error

func UpdateChain

func UpdateChain(ctx context.Context, d *daemon, host string, maxBlockID int64) error

UpdateChain load from host all blocks from our last block to maxBlockID

func WaitDB

func WaitDB(ctx context.Context) error

WaitDB waits for the end of the installation

func WaitForSignals

func WaitForSignals()

WaitForSignals waits for Interrupt os.Kill signals

func WaitStopTime

func WaitStopTime()

WaitStopTime closes the database and stop daemons

Types

type CandidateNodeMode

type CandidateNodeMode struct {
}

func (*CandidateNodeMode) GetHostWithMaxID

func (candidateNodeMode *CandidateNodeMode) GetHostWithMaxID() ([]string, error)

func (*CandidateNodeMode) GetThisNodePosition

func (candidateNodeMode *CandidateNodeMode) GetThisNodePosition() (int64, error)

type DelayedTx

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

DelayedTx represents struct which works with delayed contracts

func (*DelayedTx) RunForDelayBlockID

func (dtx *DelayedTx) RunForDelayBlockID(blockID int64) ([]*sqldb.Transaction, error)

RunForDelayBlockID creates the transactions that need to be run for blockID

type HonorNodeMode

type HonorNodeMode struct {
}

func (*HonorNodeMode) GetHostWithMaxID

func (honorNodeMode *HonorNodeMode) GetHostWithMaxID() ([]string, error)

func (*HonorNodeMode) GetThisNodePosition

func (honorNodeMode *HonorNodeMode) GetThisNodePosition() (int64, error)

type Model

type Model interface {
	GetThisNodePosition() (int64, error)
	GetHostWithMaxID() (hosts []string, err error)
}

type SelectModel

type SelectModel struct {
}

func (*SelectModel) GetHostWithMaxID

func (s *SelectModel) GetHostWithMaxID() ([]string, error)

func (*SelectModel) GetThisNodePosition

func (s *SelectModel) GetThisNodePosition() (int64, error)

func (SelectModel) GetWorkMode

func (s SelectModel) GetWorkMode() Model

type VotingRes

type VotingRes struct {
	VoteMsgInfo network.VoteMsg `json:"voteMsgInfo"`
	Err         string          `json:"err"`
}

type VotingTotal

type VotingTotal struct {
	Data          map[string]VotingRes `json:"data"`
	AgreeQuantity int64                `json:"agreeQuantity"`
	LocalAddress  string               `json:"localAddress"`
	St            int64                `json:"st"`
}

Jump to

Keyboard shortcuts

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