public SnowWorkerM1(IdGeneratorOptions options) { WorkerId = options.WorkerId; WorkerIdBitLength = options.WorkerIdBitLength; SeqBitLength = options.SeqBitLength; MaxSeqNumber = options.MaxSeqNumber; MinSeqNumber = options.MinSeqNumber; TopOverCostCount = options.TopOverCostCount; if (options.BaseTime != DateTime.MinValue) { BaseTime = options.BaseTime; } if (WorkerId < 1) { WorkerId = (ushort)DateTime.Now.Millisecond; } if (SeqBitLength == 0) { SeqBitLength = 6; } if (WorkerIdBitLength == 0) { WorkerIdBitLength = 6; } if (MaxSeqNumber == 0) { MaxSeqNumber = (int)Math.Pow(2, SeqBitLength) - 1; } _TimestampShift = (byte)(WorkerIdBitLength + SeqBitLength); _CurrentSeqNumber = options.MinSeqNumber; }
public SnowWorkerM2(IdGeneratorOptions options) : base(options) { }