utils

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2019 License: Apache-2.0 Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JSONTool = jsoniter.Config{UseNumber: true}.Froze()

Functions

func BatchFullOrTimeout added in v1.5.4

func BatchFullOrTimeout(runnerName string, stopped *int32, batchLen, batchSize int64, lastSend time.Time,
	maxBatchLen, maxBatchSize, maxBatchInterval int) bool

func CheckNotExistFile added in v1.5.4

func CheckNotExistFile(runnerName string, expireMap map[string]int64)

func DeepCopyByGob added in v1.5.4

func DeepCopyByGob(dst, src interface{})

func DeepCopyByJSON added in v1.5.4

func DeepCopyByJSON(dst, src interface{})

func GetFiles added in v1.5.4

func GetFiles(runnerName, dirPath string) (map[string]string, error)

获取指定目录下的所有文件和对应inode

func GetParseTestData added in v1.5.3

func GetParseTestData(line string, size int) []string

获取测试数据

func IsExist added in v1.5.2

func IsExist(path string) bool

IsExist checks whether a file or directory exists. It returns false when the file or directory does not exist.

func IsGzipped added in v1.5.4

func IsGzipped(data []byte) bool

gzip 前两位是固定的: https://stackoverflow.com/questions/6059302/how-to-check-if-a-file-is-gzip-compressed

func MongoDail

func MongoDail(host string, mode string, syncTimeoutInS int64) (session *mgo.Session, err error)

------------------------------------------------------------------------

func SetMode

func SetMode(s *mgo.Session, modeFriendly string, refresh bool)

func UpdateExpireMap added in v1.5.4

func UpdateExpireMap(runnerName string, fileMap map[string]string, expireMap map[string]int64)

func WriteZipToFile added in v1.5.4

func WriteZipToFile(zipf *zip.File, filename string) error

Types

type Collection

type Collection struct {
	*mgo.Collection
}

func (Collection) CloseSession

func (c Collection) CloseSession() (err error)

type MongoConfig

type MongoConfig struct {
	Host           string `json:"host"`
	DB             string `json:"db"`
	Mode           string `json:"mode"`
	SyncTimeoutInS int64  `json:"timeout"` // 以秒为单位
	Direct         bool   `json:"direct"`
}

type Stage added in v1.5.4

type Stage struct {
	Duration time.Duration
	Note     string
}

type Tracker added in v1.5.4

type Tracker struct {
	Start  time.Time
	Stages []Stage
}

func NewTracker added in v1.5.4

func NewTracker() *Tracker

func (*Tracker) Print added in v1.5.4

func (t *Tracker) Print() string

func (*Tracker) Reset added in v1.5.4

func (t *Tracker) Reset()

func (*Tracker) Track added in v1.5.4

func (t *Tracker) Track(stage string)

Directories

Path Synopsis
parse

Jump to

Keyboard shortcuts

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