1
0
mirror of synced 2026-02-23 05:17:55 +08:00

修正类型

This commit is contained in:
zhouzj
2021-03-20 20:47:19 +08:00
parent 1f5cc01168
commit 0953456f5a
3 changed files with 18 additions and 18 deletions

View File

@@ -7,14 +7,14 @@
package contract
type IdGeneratorOptions struct {
Method uint16 // 雪花计算方法,1-漂移算法|2-传统算法默认1
BaseTime int64 // 基础时间,不能超过当前系统时间
WorkerId uint16 // 机器码,与 WorkerIdBitLength 有关系
WorkerIdBitLength byte // 机器码位长范围1-21要求序列数位长+机器码位长不超过22
SeqBitLength byte // 序列数位长范围2-21要求序列数位长+机器码位长不超过22
MaxSeqNumber uint32 // 最大序列数由SeqBitLength计算的最大值
MinSeqNumber uint32 // 最小序列数默认5不小于1不大于MaxSeqNumber
TopOverCostCount uint // 最大漂移次数默认2000推荐范围500-10000与计算能力有关
Method uint16 // 雪花计算方法,1-漂移算法|2-传统算法默认1
BaseTime int64 // 基础时间,不能超过当前系统时间
WorkerId uint16 // 机器码,与 WorkerIdBitLength 有关系
WorkerIdBitLength byte // 机器码位长范围1-21要求序列数位长+机器码位长不超过22
SeqBitLength byte // 序列数位长范围2-21要求序列数位长+机器码位长不超过22
MaxSeqNumber uint32 // 最大序列数由SeqBitLength计算的最大值
MinSeqNumber uint32 // 最小序列数默认5不小于1不大于MaxSeqNumber
TopOverCostCount uint32 // 最大漂移次数默认2000推荐范围500-10000与计算能力有关
}
func NewIdGeneratorOptions(workerId uint16) *IdGeneratorOptions {

View File

@@ -7,15 +7,15 @@
package contract
type OverCostActionArg struct {
ActionType int
ActionType int32
TimeTick int64
WorkerId int64
OverCostCountInOneTerm int
GenCountInOneTerm int
TermIndex int
WorkerId uint16
OverCostCountInOneTerm int32
GenCountInOneTerm int32
TermIndex int32
}
func (ocaa OverCostActionArg) OverCostActionArg(workerId int64, timeTick int64, actionType int, overCostCountInOneTerm int, genCountWhenOverCost int, index int) {
func (ocaa OverCostActionArg) OverCostActionArg(workerId uint16, timeTick int64, actionType int32, overCostCountInOneTerm int32, genCountWhenOverCost int32, index int32) {
ocaa.ActionType = actionType
ocaa.TimeTick = timeTick
ocaa.WorkerId = workerId

View File

@@ -20,16 +20,16 @@ type SnowWorkerM1 struct {
SeqBitLength byte //自增序列数位长
MaxSeqNumber uint32 //最大序列数(含)
MinSeqNumber uint32 //最小序列数(含)
TopOverCostCount uint //最大漂移次数
TopOverCostCount uint32 //最大漂移次数
_TimestampShift byte
_CurrentSeqNumber uint32
_LastTimeTick int64
_TurnBackTimeTick int64
_TurnBackIndex byte
_IsOverCost bool
_OverCostCountInOneTerm uint
_GenCountInOneTerm uint
_TermIndex uint
_OverCostCountInOneTerm uint32
_GenCountInOneTerm uint32
_TermIndex uint32
sync.Mutex
}