master

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MSHandler

type MSHandler interface {
	OnBeMainService() error
	OnBeMainServiceFailed()
	OnLeaveMainService()
	OnTaskData(dataType int32, data any)
	OnKeepTick()
}

type MSService

type MSService struct {
	*Options
	// contains filtered or unexported fields
}

func NewMSService

func NewMSService(opts ...Option) (*MSService, error)

func (*MSService) AddTask

func (srv *MSService) AddTask(dataType int32, data any, waitOrNot bool) bool

func (*MSService) GetLatestMainServiceId added in v0.1.1

func (srv *MSService) GetLatestMainServiceId() string

func (*MSService) GetMainServiceId added in v0.1.1

func (srv *MSService) GetMainServiceId() string

func (*MSService) IsMainService added in v0.1.1

func (srv *MSService) IsMainService() bool

func (*MSService) Start

func (srv *MSService) Start(ctx context.Context) error

func (*MSService) Stop

func (srv *MSService) Stop(ctx context.Context) error

type MSTask

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

type Option

type Option func(*Options)

func WithCache

func WithCache(cache *cache.Cache) Option

func WithDistributionCacheExpireSec

func WithDistributionCacheExpireSec(distributionCacheExpireSec int64) Option

func WithDistributionCacheKey

func WithDistributionCacheKey(distributionCacheKey string) Option

func WithDistributionCacheSignature

func WithDistributionCacheSignature(distributionCacheSignature [8]byte) Option

func WithHandler

func WithHandler(handler MSHandler) Option

func WithServiceId

func WithServiceId(serviceId string) Option

func WithSrvName

func WithSrvName(srvName string) Option

func WithTWTimer

func WithTWTimer(twTimer *timewheel.TimeWheel) Option

func WithTickIntervalSec

func WithTickIntervalSec(tickIntervalSec int) Option

type Options

type Options struct {
	SrvName                    string
	TickIntervalSec            int
	DistributionCacheKey       string
	ServiceId                  string
	DistributionCacheSignature [8]byte
	DistributionCacheExpireSec int64
	TWTimer                    *timewheel.TimeWheel
	Cache                      *cache.Cache
	Handler                    MSHandler
}

Jump to

Keyboard shortcuts

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