entity

package
Version: v0.0.0-...-41ff29f Latest Latest
Warning

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

Go to latest
Published: May 21, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LeafAlloc

type LeafAlloc struct {
	BizTag      string
	MaxID       int64
	Step        int64
	Description string
	UpdateTime  time.Time
}

type Segment

type Segment struct {
	Value  *atomic.Int64
	Max    *atomic.Int64
	Step   *atomic.Int64
	Buffer *SegmentBuffer
}

func NewSegment

func NewSegment(buffer *SegmentBuffer) *Segment

func (*Segment) GetIdle

func (s *Segment) GetIdle() int64

func (*Segment) GetMax

func (s *Segment) GetMax() int64

func (*Segment) GetStep

func (s *Segment) GetStep() int64

func (*Segment) GetValue

func (s *Segment) GetValue() int64

func (*Segment) Incr

func (s *Segment) Incr() int64

func (*Segment) SetMax

func (s *Segment) SetMax(value int64)

func (*Segment) SetStep

func (s *Segment) SetStep(value int64)

func (*Segment) SetValue

func (s *Segment) SetValue(value int64)

type SegmentBuffer

type SegmentBuffer struct {
	Lock *sync.RWMutex

	Segments      []*Segment //两个segment
	Key           string
	NextReady     bool
	InitOk        *atomic.Bool
	ThreadRunning *atomic.Bool

	Step        int64
	MinStep     int64
	UpdateStamp int64
	// contains filtered or unexported fields
}

func NewSegmentBuffer

func NewSegmentBuffer(key string) *SegmentBuffer

func (*SegmentBuffer) GetCurrent

func (s *SegmentBuffer) GetCurrent() *Segment

func (*SegmentBuffer) IsInitOk

func (s *SegmentBuffer) IsInitOk() bool

func (*SegmentBuffer) NextPos

func (s *SegmentBuffer) NextPos() int

func (*SegmentBuffer) SetInitOK

func (s *SegmentBuffer) SetInitOK(value bool)

func (*SegmentBuffer) SwitchPos

func (s *SegmentBuffer) SwitchPos()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to