serv

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2020 License: MIT Imports: 15 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 ExtensionManager added in v0.1.13

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

ExtensionManager TODO

func NewExtensionManager added in v0.1.13

func NewExtensionManager(serv IServ) *ExtensionManager

NewExtensionManager TODO

func (*ExtensionManager) AddExtension added in v0.1.13

func (mgr *ExtensionManager) AddExtension(name string, extension IExtension) bool

AddExtension TODO

func (*ExtensionManager) Cleanup added in v0.1.13

func (mgr *ExtensionManager) Cleanup() (err error)

Cleanup TODO

func (*ExtensionManager) GetExtension added in v0.1.13

func (mgr *ExtensionManager) GetExtension(name string) IExtension

GetExtension TODO

func (*ExtensionManager) Setup added in v0.1.13

func (mgr *ExtensionManager) Setup() (err error)

Setup TODO

type IExtension added in v0.1.13

type IExtension interface {
	Setup() error
	Cleanup() error
}

IExtension TODO

type IServ added in v0.1.2

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

IServ TODO

type NamedExtension added in v0.1.13

type NamedExtension struct {
	IExtension
	// contains filtered or unexported fields
}

NamedExtension TODO

func (*NamedExtension) Get added in v0.1.13

func (ext *NamedExtension) Get() IExtension

Get TODO

func (*NamedExtension) ItemID added in v0.1.13

func (ext *NamedExtension) ItemID() uint64

ItemID TODO

func (*NamedExtension) Name added in v0.1.13

func (ext *NamedExtension) Name() string

Name 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 {
	*ExtensionManager

	*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) String added in v0.1.12

func (i Status) String() string

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