/// <summary> /// Initializes this generator for the given endpoint type. /// </summary> /// <param name="type"></param> public GrainIdGenerator(EndPointType type) { const ulong midPoint = (MaxValue - MinValue) / 2 + MinValue; switch (type) { case EndPointType.Client: _range = new GrainIdRange(MinValue, midPoint - 1); break; case EndPointType.Server: _range = new GrainIdRange(midPoint, MaxValue); break; default: throw new InvalidEnumArgumentException(nameof(type), (int)type, typeof(EndPointType)); } _nextId = _range.Minimum; }
static GrainIdGenerator() { TotalReservedRange = new GrainIdRange(MinValue, MaxValue); }
/// <summary> /// Initializes this generator for the given endpoint type. /// </summary> /// <param name="type"></param> public GrainIdGenerator(EndPointType type) { _range = GetRangeFor(type); _nextId = _range.Minimum; }