1
0
mirror of synced 2026-02-22 12:57:56 +08:00

editscope

This commit is contained in:
zhouzj
2021-03-13 01:46:27 +08:00
parent 624782c2ca
commit 7cd5a0e8fc
2 changed files with 16 additions and 16 deletions

View File

@@ -19,51 +19,51 @@ namespace Yitter.IdGenerator
/// 雪花计算方法
/// 1-漂移算法|2-传统算法默认1
/// </summary>
public short Method { get; set; } = 1;
public virtual short Method { get; set; } = 1;
/// <summary>
/// 开始时间UTC格式
/// 不能超过当前系统时间
/// </summary>
public DateTime StartTime { get; set; } = DateTime.MinValue;
public virtual DateTime StartTime { get; set; } = DateTime.MinValue;
/// <summary>
/// 机器码
/// 与 WorkerIdBitLength 有关系
/// </summary>
public ushort WorkerId { get; set; } = 0;
public virtual ushort WorkerId { get; set; } = 0;
/// <summary>
/// 机器码位长
/// 范围2-21要求序列数位长+机器码位长不超过22
/// 建议范围6-12。
/// </summary>
public byte WorkerIdBitLength { get; set; } = 6;//10;
public virtual byte WorkerIdBitLength { get; set; } = 6;//10;
/// <summary>
/// 序列数位长
/// 范围2-21要求序列数位长+机器码位长不超过22
/// 建议范围6-14。
/// </summary>
public byte SeqBitLength { get; set; } = 6;//10;
public virtual byte SeqBitLength { get; set; } = 6;//10;
/// <summary>
/// 最大序列数(含)
/// 由SeqBitLength计算的最大值
/// </summary>
public int MaxSeqNumber { get; set; } = 0;
public virtual int MaxSeqNumber { get; set; } = 0;
/// <summary>
/// 最小序列数(含)
/// 默认11不小于5不大于MaxSeqNumber-2
/// </summary>
public ushort MinSeqNumber { get; set; } = 11;
public virtual ushort MinSeqNumber { get; set; } = 11;
/// <summary>
/// 最大漂移次数(含),
/// 默认2000推荐范围500-10000与计算能力有关
/// </summary>
public int TopOverCostCount { get; set; } = 2000;
public virtual int TopOverCostCount { get; set; } = 2000;
public IdGeneratorOptions()

View File

@@ -22,29 +22,29 @@ namespace Yitter.IdGenerator
/// 事件类型
/// 1-开始2-结束8-漂移
/// </summary>
public int ActionType { get; set; }
public virtual int ActionType { get; set; }
/// <summary>
/// 时间戳
/// </summary>
public long TimeTick { get; set; }
public virtual long TimeTick { get; set; }
/// <summary>
/// 机器码
/// </summary>
public ushort WorkerId { get; set; }
public virtual ushort WorkerId { get; set; }
/// <summary>
/// 漂移计算次数
/// </summary>
public int OverCostCountInOneTerm { get; set; }
public virtual int OverCostCountInOneTerm { get; set; }
/// <summary>
/// 漂移期间生产ID个数
/// </summary>
public int GenCountInOneTerm { get; set; }
public virtual int GenCountInOneTerm { get; set; }
/// <summary>
/// 漂移周期
/// </summary>
public int TermIndex { get; set; }
public OverCostActionArg(ushort workerId, long timeTick, int actionType = 0, int overCostCountInOneTerm = 0, int genCountWhenOverCost = 0,int index=0)
public virtual int TermIndex { get; set; }
public OverCostActionArg(ushort workerId, long timeTick, int actionType = 0, int overCostCountInOneTerm = 0, int genCountWhenOverCost = 0, int index = 0)
{
ActionType = actionType;
TimeTick = timeTick;