core

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2019 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const ConsensusTopic = "consensus"

ConsensusTopic is the topic used in consensus algorithm

View Source
const MaxBulkTransactionSize = 2 << 17 //128KB bulks

MaxBulkTransactionSize specifies the maximum size of one bulk with txs which can be send over the network TODO convert this const into a var and read it from config when this code moves to another binary

Variables

View Source
var ErrInvalidValue = errors.New("invalid value provided")

ErrInvalidValue signals that a nil value has been provided

View Source
var ErrNilCoordinator = errors.New("nil coordinator provided")

ErrNilCoordinator signals that a nil shardCoordinator has been provided

View Source
var ErrNilHasher = errors.New("nil hashser provided")

ErrNilHasher signals that a nil marshalizer has been provided

View Source
var ErrNilInputData = errors.New("nil input data")

ErrNilInputData signals that a nil data has been provided

View Source
var ErrNilLogger = errors.New("nil logger provided")

ErrNilLogger signals that a nil logger has been provided

View Source
var ErrNilMarshalizer = errors.New("nil marshalizer provided")

ErrNilMarshalizer signals that a nil marshalizer has been provided

View Source
var ErrNilUrl = errors.New("url is empty")

ErrNilUrl signals that the provided url is empty

View Source
var ErrWrongTypeAssertion = errors.New("wrong type assertion")

ErrWrongTypeAssertion signals that an type assertion failed

Functions

func CalculateHash

func CalculateHash(
	marshalizer marshal.Marshalizer,
	hasher hashing.Hasher,
	object interface{},
) ([]byte, error)

CalculateHash marshalizes the interface and calculates its hash

func ConvertBytes

func ConvertBytes(bytes uint64) string

ConvertBytes converts the input bytes in a readable string using multipliers (k, M, G)

func CreateFile

func CreateFile(prefix string, subfolder string, fileExtension string) (*os.File, error)

CreateFile opens or creates a file relative to the default path

func GetTrimmedPk

func GetTrimmedPk(pk string) string

GetTrimmedPk returns a trimmed string to the pkPrefixSize value

func LoadJsonFile

func LoadJsonFile(dest interface{}, relativePath string, log *logger.Logger) error

LoadJsonFile method to open and decode json file

func LoadP2PConfig

func LoadP2PConfig(filepath string) (*config.P2PConfig, error)

LoadP2PConfig returns a P2PConfig by reading the config file provided

func LoadServersPConfig added in v1.0.3

func LoadServersPConfig(filepath string) (*config.ServersConfig, error)

LoadServersPConfig returns a ServersConfig by reading the config file provided

func LoadSkFromPemFile added in v1.0.3

func LoadSkFromPemFile(relativePath string, log *logger.Logger, skIndex int) ([]byte, error)

LoadSkFromPemFile loads the secret key bytes stored in the file

func LoadTomlFile

func LoadTomlFile(dest interface{}, relativePath string, log *logger.Logger) error

LoadTomlFile method to open and decode toml file

func OpenFile

func OpenFile(relativePath string, log *logger.Logger) (*os.File, error)

OpenFile method opens the file from given path - does not close the file

func SaveSkToPemFile

func SaveSkToPemFile(file *os.File, identifier string, skBytes []byte) error

SaveSkToPemFile saves secret key bytes in the file

func ToB64 added in v1.0.3

func ToB64(buff []byte) string

ToB64 encodes the given buff to base64

func ToHex

func ToHex(buff []byte) string

ToHex encodes the given buff to hex

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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