core

package
v0.0.0-...-8306ff7 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HttpClientRequestTimeout       = 10 * time.Second
	HttpClientRequestDialerTimeout = 10 * time.Second
	TLSHandshakeTimeout            = 10 * time.Second
	Peer2PeerValidationRetryLimit  = 3

	// Message to DAPP / Clients of blockchain
	NodeIsBeingShutdown           = "node is being shutdown, try after sometime"
	NodeIsBeingStarted            = "node is being started, try after sometime"
	SomeParticipantsDown          = "Some participant nodes are down"
	NodeIsNotReadyToAcceptRequest = "node is not ready to accept request"
)

Variables

View Source
var ErrNodeDown = errors.New("node is not up")

Functions

func CallREST

func CallREST(client *http.Client, rpcUrl string, method string, rpcReq []byte) (string, error)

func CallRPC

func CallRPC(client *http.Client, rpcUrl string, rpcReq []byte, resData interface{}) error

func NewHttpClient

func NewHttpClient(tls *tls.Config) *http.Client

NewHttpClient returns a new customized http client

func RandomInt

func RandomInt(min int, max int) int

RandomInt returns a random int within a range of min to max

Types

type ClientStatus

type ClientStatus uint8

ClientStatus indicates the combined status of both blockchain client and privacy manager processes

const (
	Up   ClientStatus // indicates both blockchain client and privacy manager are up
	Down              // indicates that both blockchain client and privacy manager are down
)

type NodeStatus

type NodeStatus uint8

NodeStatus indicates the status of node hibernator

const (
	ShutdownInprogress NodeStatus // indicates that node hibernator is shutting down both blockchain client and privacy manager
	StartupInprogress             // indicates that node hibernator is starting up both blockchain client and privacy manager
	ConsensusWait
	OK // default status of node hibernator when its not doing anything
)

type RpcError

type RpcError struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

func (*RpcError) Error

func (e *RpcError) Error() string

Jump to

Keyboard shortcuts

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