serv

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2020 License: MIT Imports: 13 Imported by: 3

Documentation

Index

Constants

View Source
const (
	ServStatusChanged string = "ServStatusChanged"
)

Topics

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(context.Context) error
	OnStop(context.Context) error
}

IServ 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) 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) Info added in v0.2.0

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

Info TODO

func (*Serv) Message added in v0.2.0

func (serv *Serv) Message() messagebus.MessageBus

Message TODO

func (*Serv) OnStart added in v0.1.2

func (serv *Serv) OnStart(ctx context.Context) (err error)

OnStart TODO

func (*Serv) OnStop added in v0.1.2

func (serv *Serv) OnStop(ctx context.Context) (err error)

OnStop TODO

func (*Serv) PID added in v0.2.0

func (serv *Serv) PID() int

PID TODO

func (*Serv) Process added in v0.2.0

func (serv *Serv) Process() *process.Process

Process TODO

func (*Serv) SetStatus

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

SetStatus TODO

func (*Serv) Status

func (serv *Serv) Status() Status

Status TODO

func (*Serv) Toggle added in v0.2.0

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

Toggle TODO

type Status

type Status int

Status type

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

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