Documentation ¶
Index ¶
- func GetUniqueId(business string) (uint64, error)
- func UpdateIdSet(list BufferInterface)
- func UpdateWareHouse(business_type string)
- type Buffer
- type BufferInterface
- type IdSet
- type UniqueIdRpcService
- type WareHouse
- func (w *WareHouse) Acquire(business string) (uint64, error)
- func (w *WareHouse) AddNewToWareHouse(business_type string, set *IdSet)
- func (w *WareHouse) Get(business_type string) (*IdSet, bool)
- func (w *WareHouse) RemoveToWareHouse(business_type string)
- func (w *WareHouse) SetHouse(business string, set *IdSet)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetUniqueId ¶
func UpdateIdSet ¶
func UpdateIdSet(list BufferInterface)
func UpdateWareHouse ¶
func UpdateWareHouse(business_type string)
Types ¶
type Buffer ¶
type Buffer struct { Start uint64 // the start value of id Current uint64 // current id value, plus one per time when id was acquired End uint64 // the max value of id Duration uint64 // End - Start Cap uint64 // End - Current Num int // the serial number Fulling bool // if getting the buffer full Initialized bool BufferSource BufferInterface // contains filtered or unexported fields }
func (*Buffer) GetBufferFull ¶
func (b *Buffer) GetBufferFull()
type BufferInterface ¶
type IdSet ¶
type IdSet struct { Set []*Buffer Count int // len(Set) SetIndexMax int // Count - 1 Index int // contains filtered or unexported fields }
func GetNewIdSet ¶
type UniqueIdRpcService ¶
type UniqueIdRpcService struct{}
func (*UniqueIdRpcService) MakeUniqueId ¶
func (u *UniqueIdRpcService) MakeUniqueId(c ctx.Context, business *id_rpc.BusinessType) (*id_rpc.UniqueId, error)
type WareHouse ¶
type WareHouse struct { HouseMap map[string]*IdSet // every business type has an IdSet // contains filtered or unexported fields }
var House *WareHouse
generate ID uniquely and increasingly the ID is an integer that created from database
func NewWareHouse ¶
func NewWareHouse() *WareHouse
func (*WareHouse) AddNewToWareHouse ¶
func (*WareHouse) RemoveToWareHouse ¶
Click to show internal directories.
Click to hide internal directories.