jarvisbase

package
v0.7.212 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2019 License: Apache-2.0 Imports: 14 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildLogFilename added in v0.7.192

func BuildLogFilename(logtype string, subname string) string

BuildLogFilename -

func BuildLogSubFilename added in v0.7.192

func BuildLogSubFilename(appName string, version string) string

BuildLogSubFilename -

func ClearLogs added in v0.7.161

func ClearLogs() error

ClearLogs - clear logs

func Debug

func Debug(message string, fields ...zap.Field)

Debug logs a debug message with the given fields

func Error

func Error(message string, fields ...zap.Field)

Error logs a debug message with the given fields

func Fatal

func Fatal(message string, fields ...zap.Field)

Fatal logs a message than calls os.Exit(1)

func Info

func Info(message string, fields ...zap.Field)

Info logs a debug message with the given fields

func InitLogger

func InitLogger(level zapcore.Level, isConsole bool, logpath string,
	nodeType string)

InitLogger - initializes a thread-safe singleton logger

func JSON

func JSON(key string, obj interface{}) zap.Field

JSON - make json to field

func MD5Protobuf added in v0.7.208

func MD5Protobuf(pb proto.Message) (string, error)

MD5Protobuf - md5 protobuf and return string

func SyncLogger

func SyncLogger()

SyncLogger - sync logger

func Warn

func Warn(message string, fields ...zap.Field)

Warn logs a debug message with the given fields

Types

type L2BaseTask added in v0.7.130

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

L2BaseTask - level 2 basetask

func (*L2BaseTask) GetParentID added in v0.7.130

func (task *L2BaseTask) GetParentID() string

GetParentID - get parentID

func (*L2BaseTask) GetTaskID added in v0.7.130

func (task *L2BaseTask) GetTaskID() int64

GetTaskID - get taskID

func (*L2BaseTask) Init added in v0.7.130

func (task *L2BaseTask) Init(pool L2RoutinePool, parentID string)

Init - init

type L2RoutinePool added in v0.7.130

type L2RoutinePool interface {
	// SendTask - send new task
	SendTask(task L2Task)
	// Start - start a routine pool
	Start(ctx context.Context, maxNums int) error
	// GetStatus - get status
	GetStatus() string
	// NewTaskID - new taskID
	NewTaskID() int64
	// BuildStatus - build status
	BuildStatus() *jarviscorepb.L2PoolInfo
}

L2RoutinePool - L2RoutinePool

func NewL2RoutinePool added in v0.7.130

func NewL2RoutinePool() L2RoutinePool

NewL2RoutinePool - new RoutinePool

type L2Task added in v0.7.130

type L2Task interface {
	// Run - run task
	Run(ctx context.Context) error
	// GetParentID - get parentID
	GetParentID() string
	// GetTaskID - get taskID
	GetTaskID() int64
}

L2Task - level 2 task

type RoutinePool

type RoutinePool interface {
	// SendTask - send new task
	SendTask(task Task)
	// Start - start a routine pool
	Start(ctx context.Context, maxNums int) error
	// GetStatus - get status
	GetStatus() string
}

RoutinePool - RoutinePool

func NewRoutinePool

func NewRoutinePool() RoutinePool

NewRoutinePool - new RoutinePool

type Task

type Task interface {
	Run(ctx context.Context) error
}

Task - task

Jump to

Keyboard shortcuts

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