// 42位时间戳 + 1位 + 9位工作节点 + 12位序列号
type UuidService struct {
Pilot int64 //标记位 轮训使用 服务启动时会有多个node节点 每次调用时轮训使用其中的一个node节点
Nodes []*Node //一台服务上可以有多个节点
}
type Node struct {
mu sync.Mutex
node int64 //节点id
step int64 //序号
timeId int64 //时间线序号
backoffMap map[int64]int64 //两条时间线对应的时间戳
}
网友评论