service

package
v2.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2021 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 Alloc

type Alloc struct {
	Mu        sync.RWMutex
	BizTagMap map[string]*BizAlloc
}

type BizAlloc

type BizAlloc struct {
	Mu      sync.Mutex
	BazTag  string
	IdArray []*IdArray
	GetDb   bool //当前正在查询DB
}

func (*BizAlloc) GetId

func (b *BizAlloc) GetId(s *Service) (id int64, err error)

func (*BizAlloc) GetIdArray

func (b *BizAlloc) GetIdArray(cancel context.CancelFunc, s *Service)

func (*BizAlloc) LeftIdCount

func (b *BizAlloc) LeftIdCount() (count int64)

func (*BizAlloc) PopId

func (b *BizAlloc) PopId() (id int64)

type IdArray

type IdArray struct {
	Cur   int64 //当前发到哪个位置
	Start int64 //最小值
	End   int64 //最大值
}

type Service

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

func NewService

func NewService(c *configs.Config) (s *Service)

func (*Service) Close

func (s *Service) Close()

func (*Service) CreateTag

func (s *Service) CreateTag(e *entity.Segments) error

func (*Service) GetId

func (s *Service) GetId(tag string) (id int64, err error)

func (*Service) NewAllocId

func (s *Service) NewAllocId() (a *Alloc, err error)

Jump to

Keyboard shortcuts

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