server

package
v0.0.0-...-0a36b5b Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2019 License: MIT, MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NodeDaemon

type NodeDaemon struct {
	Port    int
	Host    string
	DataDir string
	Server  *NodeServer
	Logger  *utils.LoggerMan
	Node    *nodemanager.Node
}

func (*NodeDaemon) DaemonizeServer

func (n *NodeDaemon) DaemonizeServer() error

Makes a daemon process. It starts node server and waits for interrupt signal when to exit.

func (*NodeDaemon) GetRunningProcessInfo

func (n *NodeDaemon) GetRunningProcessInfo() (int, string)

Returns port and auth string of currently running process

func (*NodeDaemon) GetServerState

func (n *NodeDaemon) GetServerState() (bool, int, int, error)

* Returns state of a server. Detects if it is running

func (*NodeDaemon) Init

func (n *NodeDaemon) Init() error

func (*NodeDaemon) StartServer

func (n *NodeDaemon) StartServer() error

func (*NodeDaemon) StartServerInteractive

func (n *NodeDaemon) StartServerInteractive() error

func (*NodeDaemon) StopServer

func (n *NodeDaemon) StopServer() error

type NodeServer

type NodeServer struct {
	DataDir string
	Node    *nodemanager.Node

	NodeAddress netlib.NodeAddr

	Transit nodeTransit

	Logger *utils.LoggerMan
	// Channels to manipulate roitunes
	StopMainChan        chan struct{}
	StopMainConfirmChan chan struct{}
	BlockBilderChan     chan []byte

	NodeAuthStr string
}

func (*NodeServer) BlockBuilder

func (s *NodeServer) BlockBuilder()

* The routine that tries to make blocks. * The routine reads last added transaction ID * The ID will be real tranaction ID only if this transaction wa new created on this node * in this case, if block is not created, the transaction will be sent to all other nodes * it is needed to delay sending of transaction to be able to create a block first, before all other eceive new transaction * This ID can be also {0} (one byte slice). it means try to create a block but don't send transaction * and it can be empty slice . it means to exit from teh routibe

func (*NodeServer) CloneNode

func (s *NodeServer) CloneNode() *nodemanager.Node

* Creates clone of a node object. We use this in case if we need separate object * for a routine. This prevents conflicts of pointers in different routines

func (*NodeServer) GetClient

func (s *NodeServer) GetClient() *nodeclient.NodeClient

func (*NodeServer) StartServer

func (s *NodeServer) StartServer(serverStartResult chan string) error

func (*NodeServer) TryToMakeNewBlock

func (s *NodeServer) TryToMakeNewBlock(tx []byte)

* Sends signal to routine where we make blocks. This makes the routine to check transactions in unapproved cache * And try to make a block if there are enough transactions

type NodeServerRequest

type NodeServerRequest struct {
	Node              *nodemanager.Node
	S                 *NodeServer
	Request           []byte
	RequestIP         string
	Logger            *utils.LoggerMan
	HasResponse       bool
	Response          []byte
	NodeAuthStrIsGood bool
	SessID            string
}

func (*NodeServerRequest) Init

func (s *NodeServerRequest) Init()

Jump to

Keyboard shortcuts

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