util

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2018 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UNSUBSCRIBE = true
)

Variables

View Source
var (
	ConfigFileFlag = cli.StringFlag{
		Name:  "config",
		Usage: "config file",
		Value: "../config.toml",
	}
	CPUProfileFlag = cli.StringFlag{
		Name:  "cpu-profile",
		Usage: "write cpu profile to file",
	}
	MemProfileFlag = cli.StringFlag{
		Name:  "mem-profile",
		Usage: "write memory profile to file",
	}
)
View Source
var Flags = map[string]cli.Flag{
	"p2p_port": cli.IntFlag{
		Name:  "p2p_port",
		Usage: "p2p network port",
	},
	"http_port": cli.IntFlag{
		Name:  "http_port",
		Usage: "http rpc network port",
	},
	"dbpath": cli.StringFlag{
		Name:  "dbpath",
		Usage: "braft leveldb path",
	},
	"bch_host": cli.StringFlag{
		Name:  "bch-host",
		Usage: "the bch host that the node watch",
	},
	"bch_height": cli.Int64Flag{
		Name:  "bch-height",
		Usage: "start watching height",
	},
	"loglevel": cli.StringFlag{
		Name:  "loglevel",
		Usage: "log level, debug, info, warn, error or crti",
	},
}

Functions

func BytesToI64

func BytesToI64(bytes []byte) (v int64, e error)

func BytesToU64

func BytesToU64(bytes []byte) (v uint64, e error)

func FeedBin

func FeedBin(hasher *crypto.Hasher256, data []byte)

func FeedBinField

func FeedBinField(hasher *crypto.Hasher256, fieldName string, data []byte)

func FeedDigestField

func FeedDigestField(hasher *crypto.Hasher256, fieldName string, digest *crypto.Digest256)

func FeedField

func FeedField(hasher *crypto.Hasher256, fieldName string, fn FeedBodyFn)

func FeedInt32Field

func FeedInt32Field(hasher *crypto.Hasher256, fieldName string, n int32)

func FeedInt64Field

func FeedInt64Field(hasher *crypto.Hasher256, fieldName string, n int64)

func FeedText

func FeedText(hasher *crypto.Hasher256, data string)

func FeedTextField

func FeedTextField(hasher *crypto.Hasher256, fieldName string, data string)

func FeedTimestampField

func FeedTimestampField(hasher *crypto.Hasher256, fieldName string, ts int64)

func GetCPUProfile

func GetCPUProfile(ctx *cli.Context) string

GetCPUProfile 获取CPU profile的保存文件路径

func GetConfigFile

func GetConfigFile(ctx *cli.Context) string

GetConfigFile 获取config文件

func GetHomeDir

func GetHomeDir() (string, error)

func GetMemProfile

func GetMemProfile(ctx *cli.Context) string

GetMemProfile 获取内存分析的保存文件路径

func I64ToBytes

func I64ToBytes(v int64) []byte

func MsToTime

func MsToTime(timeMs int64) time.Time

MsToTime unix timestampMs to time.Time

func NewApp

func NewApp() *cli.App

NewApp creates an APP

func NowMs

func NowMs() int64

func ReadConfigToViper

func ReadConfigToViper(ctx *cli.Context)

ReadConfigToViper 把命令行传入的参数保存到viper配置里面

func U64ToBytes

func U64ToBytes(v uint64) []byte

Types

type Event

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

func NewEvent

func NewEvent() *Event

func (*Event) Emit

func (e *Event) Emit(params ...interface{})

Emit trigger the handlers that subscribe the interface

func (*Event) Size

func (e *Event) Size() int

func (*Event) Subscribe

func (e *Event) Subscribe(h interface{})

type FeedBodyFn

type FeedBodyFn func(*crypto.Hasher256)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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