Documentation
¶
Overview ¶
Code generated by mockery v1.0.0
Code generated by mockery v1.0.0
Index ¶
- Variables
- func CallMethod(i interface{}, methodName string) interface{}
- func Caller(steps int) string
- func CheckSign(publicKeys [][]byte, forSign string, signs []byte, nodeKeyOrLogin bool) (bool, error)
- func ChooseBestHost(ctx context.Context, hosts []string, logger *log.Entry) (string, int64, error)
- func CopyFileContents(src, dst string) error
- func CreateDirIfNotExists(dir string, mode os.FileMode) error
- func ErrInfo(verr interface{}, additionally ...string) error
- func ErrInfoFmt(err string, a ...interface{}) error
- func GetBlocksBody(host string, blockID int64, blocksCount int32, dataTypeBlockBody int64, ...) (chan []byte, error)
- func GetCurrentDir() string
- func GetHTTPTextAnswer(url string) (string, error)
- func GetHostBlockID(host string, logger *log.Entry) (int64, error)
- func GetHostPort(h string) string
- func GetNodeKeys() (string, string, error)
- func GetParent() string
- func LockOrDie(dir string) *flock.Flock
- func MakeDirectory(dir string) error
- func MerkleTreeRoot(dataArray [][]byte) []byte
- func ShellExecute(cmdline string)
- func ShuffleSlice(slice []string)
- func TCPConn(Addr string) (net.Conn, error)
- func TypeInt(txType string) int64
- func UUID() string
- type BlockData
- type BlockTimeCalculator
- type Cert
- type Clock
- type ClockWrapper
- type MockClock
Constants ¶
This section is empty.
Variables ¶
var ( // ReturnCh is chan for returns ReturnCh chan string // CancelFunc is represents cancel func CancelFunc context.CancelFunc // DaemonsCount is number of daemons DaemonsCount int )
var DuplicateBlockError = errors.New("block with that time interval already exists in db")
var TimeError = errors.New("current time before first block")
Functions ¶
func CallMethod ¶
func CallMethod(i interface{}, methodName string) interface{}
CallMethod calls the function by its name
func CheckSign ¶
func CheckSign(publicKeys [][]byte, forSign string, signs []byte, nodeKeyOrLogin bool) (bool, error)
CheckSign checks the signature
func ChooseBestHost ¶
best host is a host with the biggest last block ID
func ErrInfoFmt ¶
ErrInfoFmt fomats the error message
func GetBlocksBody ¶
func GetBlocksBody(host string, blockID int64, blocksCount int32, dataTypeBlockBody int64, reverseOrder bool) (chan []byte, error)
GetBlocksBody is retrieving `blocksCount` blocks bodies starting with blockID and puts them in the channel
func GetHTTPTextAnswer ¶
GetHTTPTextAnswer returns HTTP answer as a string
func GetHostPort ¶
func GetNodeKeys ¶
GetNodeKeys returns node private key and public key
func GetParent ¶
func GetParent() string
GetParent returns the information where the call of function happened
func MakeDirectory ¶
MakeDirectory makes directory if is not exists
func MerkleTreeRoot ¶
MerkleTreeRoot rertun Merkle value
func ShuffleSlice ¶
func ShuffleSlice(slice []string)
Types ¶
type BlockData ¶
type BlockData struct { BlockID int64 Time int64 EcosystemID int64 KeyID int64 NodePosition int64 Sign []byte Hash []byte Version int }
BlockData is a structure of the block's header
func ParseBlockHeader ¶
ParseBlockHeader is parses block header
type BlockTimeCalculator ¶
type BlockTimeCalculator struct {
// contains filtered or unexported fields
}
BlockTimeCalculator calculating block generation time
func BuildBlockTimeCalculator ¶
func BuildBlockTimeCalculator(transaction *model.DbTransaction) (BlockTimeCalculator, error)
func NewBlockTimeCalculator ¶
func (*BlockTimeCalculator) SetClock ¶
func (btc *BlockTimeCalculator) SetClock(clock Clock) *BlockTimeCalculator
func (*BlockTimeCalculator) TimeToGenerate ¶
func (btc *BlockTimeCalculator) TimeToGenerate(nodePosition int64) (bool, error)
func (*BlockTimeCalculator) ValidateBlock ¶
type Cert ¶
type Cert struct {
// contains filtered or unexported fields
}