service

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Stop     = 0
	Running  = 1
	Starting = 2
	Stopping = 3
)

Variables

View Source
var (
	NonexistentService = func(intr string) error {
		return errors.New(fmt.Sprintf("no service as '%s'", intr))
	}
)
View Source
var UsePool bool

Functions

func Setup

func Setup(s IService) bool

func Start

func Start(name ...string)

func WaitStop

func WaitStop()

Types

type Caller

type Caller interface {
	Call(ctx Context, fname string, args, reply interface{}) error
	Delay(ctx Context, fname string, args, reply interface{}) *request
}

func GetService

func GetService(serviceName string) (Caller, error)

type Context

type Context = context.Context

type IService

type IService interface {
	MessagePool

	Wait()      // 6
	OnInit()    // 3
	OnStart()   // 5
	OnRelease() // 8

	Init(IService)    // 1
	Start(IService)   // 4
	Release(IService) // 7

	Dispatch() // 4.1

	OnEXIT()
	Status() int
	EXIT(IService)
	SetName(string)
	GetName() string
}

type LPC

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

func (*LPC) Call

func (l *LPC) Call(ctx Context, fname string, args, reply interface{}) error

func (*LPC) Delay

func (l *LPC) Delay(ctx Context, fname string, args, reply interface{}) *request

type MessagePool

type MessagePool interface {
	Put(*request)
}

type RPC

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

func (*RPC) Call

func (l *RPC) Call(ctx Context, fname string, args, reply interface{}) error

func (*RPC) Delay

func (l *RPC) Delay(ctx Context, fname string, args, reply interface{}) *request

type Reset

type Reset interface {
	Reset()
}

Reset defines Reset method for pooled object.

type Service

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

func (*Service) Dispatch

func (s *Service) Dispatch()

func (*Service) EXIT

func (s *Service) EXIT(svc IService)

func (*Service) GetName

func (s *Service) GetName() string

func (*Service) Init

func (s *Service) Init(svc IService)

func (*Service) OnEXIT

func (s *Service) OnEXIT()

func (*Service) OnInit

func (s *Service) OnInit()

func (*Service) OnRelease

func (s *Service) OnRelease()

func (*Service) OnStart

func (s *Service) OnStart()

func (*Service) Put

func (s *Service) Put(req *request)

func (*Service) Release

func (s *Service) Release(svc IService)

func (*Service) SetName

func (s *Service) SetName(serviceName string)

func (*Service) SetProcessNum

func (s *Service) SetProcessNum(max int)

func (*Service) Start

func (s *Service) Start(svc IService)

func (*Service) Status

func (s *Service) Status() int

func (*Service) Wait

func (s *Service) Wait()

Jump to

Keyboard shortcuts

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