serv

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: MIT Imports: 11 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

StatusMap TODO

Functions

func StopStatus

func StopStatus(status Status) bool

StopStatus TODO

func WorkStatus

func WorkStatus(status Status) bool

WorkStatus TODO

Types

type IServ added in v0.1.2

type IServ interface {
	OnStart() error
	OnStop() error
}

IServ TODO

type RedisServ

type RedisServ struct {
	*Serv
	// contains filtered or unexported fields
}

RedisServ TODO

func NewRedisServ

func NewRedisServ(conf *viper.Viper, client *redis.Client) *RedisServ

NewRedisServ TODO

func (*RedisServ) Client

func (serv *RedisServ) Client() *redis.Client

Client TODO

func (*RedisServ) MetaInfo added in v0.1.1

func (serv *RedisServ) MetaInfo() (result sth.Result, err error)

MetaInfo TODO

func (*RedisServ) RedisInfo

func (serv *RedisServ) RedisInfo(section ...string) (utils.ParsedRedisInfo, error)

RedisInfo TODO

type Serv

type Serv struct {
	*sync.RWMutex
	// contains filtered or unexported fields
}

Serv TODO

func New

func New(conf *viper.Viper) *Serv

New TODO

func (*Serv) CPUPercent

func (serv *Serv) CPUPercent() float64

CPUPercent TODO

func (*Serv) Conf

func (serv *Serv) Conf() *viper.Viper

Conf TODO

func (*Serv) DoWithLock

func (serv *Serv) DoWithLock(f func() (interface{}, error), rLock bool) (interface{}, error)

DoWithLock TODO

func (*Serv) DoWithLockOnWorkStatus

func (serv *Serv) DoWithLockOnWorkStatus(f func() (interface{}, error), rLock bool, mustWorking bool) (interface{}, error)

DoWithLockOnWorkStatus TODO

func (*Serv) Getpid

func (serv *Serv) Getpid() int

Getpid TODO

func (*Serv) MetaInfo added in v0.1.1

func (serv *Serv) MetaInfo() (result sth.Result)

MetaInfo TODO

func (*Serv) OnStart added in v0.1.2

func (serv *Serv) OnStart() error

OnStart TODO

func (*Serv) OnStop added in v0.1.2

func (serv *Serv) OnStop() error

OnStop TODO

func (*Serv) ProcessMemory

func (serv *Serv) ProcessMemory() *process.MemoryInfoStat

ProcessMemory TODO

func (*Serv) SetStatus

func (serv *Serv) SetStatus(newStatus Status, lock bool) (err error)

SetStatus TODO

func (*Serv) Status

func (serv *Serv) Status(lock bool) Status

Status TODO

func (*Serv) Switch added in v0.1.1

func (serv *Serv) Switch(pauseOrResume bool) (sth.Result, error)

Switch TODO

type Status

type Status int

Status type

const (
	Init      Status // init
	Preparing        // preparing
	Working          // working
	Paused           // paused
	Stopping         // stopping
	Stopped          // stopped
)

Status enum

func (Status) MarshalJSON

func (s Status) MarshalJSON() ([]byte, error)

MarshalJSON TODO

func (*Status) UnmarshalJSON

func (s *Status) UnmarshalJSON(b []byte) error

UnmarshalJSON unmashals a quoted json string to the enum value

type StatusConflictError added in v0.1.6

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

StatusConflictError TODO

func (*StatusConflictError) Error added in v0.1.6

func (e *StatusConflictError) Error() string

type StatusError

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

StatusError TODO

func (*StatusError) Error

func (e *StatusError) Error() string

Jump to

Keyboard shortcuts

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