private ActivationId(UniqueKey key) { this.Key = key; }
internal static GrainId NewSystemTargetGrainIdByTypeCode(int typeData) { return(FindOrCreateGrainId(UniqueKey.NewSystemTargetKey(Guid.NewGuid(), typeData))); }
internal static GrainId GetSystemTargetGrainId(int typeData, string systemGrainId) { return(FindOrCreateGrainId(UniqueKey.NewSystemTargetKey(systemGrainId, typeData))); }
internal static GrainId NewClientId(Guid id, string clusterId = null) { return(FindOrCreateGrainId(UniqueKey.NewKey(id, clusterId == null ? UniqueKey.Category.Client : UniqueKey.Category.GeoClient, 0, clusterId))); }
internal static GrainId GetSystemGrainId(Guid guid) { return(FindOrCreateGrainId(UniqueKey.NewKey(guid, UniqueKey.Category.SystemGrain))); }
internal static GrainId GetGrainId(long typeCode, string primaryKey) { return(FindOrCreateGrainId(UniqueKey.NewKey(0L, UniqueKey.Category.KeyExtGrain, typeCode, primaryKey))); }
private GrainId(UniqueKey key) : base(key) { }
internal static LegacyGrainId NewClientId(Guid id) { return(FindOrCreateGrainId(UniqueKey.NewKey(id, UniqueKey.Category.Client, 0))); }
// For testing only. internal static LegacyGrainId GetGrainIdForTesting(Guid guid) { return(FindOrCreateGrainId(UniqueKey.NewKey(guid))); }
private static LegacyGrainId FindOrCreateGrainId(UniqueKey key) { return(grainIdInternCache.FindOrCreate(key, k => new LegacyGrainId(k))); }
internal LegacyGrainId(UniqueKey key) { this.Key = key; }
internal static LegacyGrainId GetGrainServiceGrainId(int typeData, string systemGrainId) { return(FindOrCreateGrainId(UniqueKey.NewGrainServiceKey(systemGrainId, typeData))); }
internal static ActivationId GetActivationId(UniqueKey key) { return(legacyKeyInterner.FindOrCreate(key, k => new ActivationId(k))); }
public static ActivationId NewId() { return(GetActivationId(UniqueKey.NewKey())); }
internal GrainId(UniqueKey key) : base(key) { }
internal static LegacyGrainId GetSystemTargetGrainId(long typeData) { return(FindOrCreateGrainId(UniqueKey.NewEmptySystemTargetKey(typeData))); }
protected UniqueIdentifier(UniqueKey key) { Key = key; }
internal static GrainType GetGrainType(long typeCode, bool isKeyExt) { return(GetGrainType(isKeyExt ? UniqueKey.NewKey(0, UniqueKey.Category.KeyExtGrain, typeCode, "keyext") : UniqueKey.NewKey(0, UniqueKey.Category.Grain, typeCode))); }
internal static GrainId GetGrainServiceGrainId(short id, int typeData) { return(FindOrCreateGrainId(UniqueKey.NewGrainServiceKey(id, typeData))); }
private ActivationId(UniqueKey key) : base(key) { }
public static GrainId NewId() { return(FindOrCreateGrainId(UniqueKey.NewKey(Guid.NewGuid(), UniqueKey.Category.Grain))); }
public static ActivationId NewId() { return(FindOrCreate(UniqueKey.NewKey())); }
internal static GrainId GetGrainId(UniqueKey key) { return(FindOrCreateGrainId(key)); }
internal static ActivationId GetActivationId(UniqueKey key) { return(FindOrCreate(key)); }
// For testing only. internal static GrainId GetGrainIdForTesting(Guid guid) { return(FindOrCreateGrainId(UniqueKey.NewKey(guid, UniqueKey.Category.None))); }
private static ActivationId FindOrCreate(UniqueKey key) { return(interner.FindOrCreate(key, () => new ActivationId(key))); }
internal static GrainId GetSystemTargetGrainId(short systemGrainId) { return(FindOrCreateGrainId(UniqueKey.NewSystemTargetKey(systemGrainId))); }
public static GrainId NewClientAddressableGrainId() { return(FindOrCreateGrainId(UniqueKey.NewKey(Guid.NewGuid(), UniqueKey.Category.ClientAddressableObject))); }
internal static GrainId GetGrainId(long typeCode, Guid primaryKey, string keyExt = null) { return(FindOrCreateGrainId(UniqueKey.NewKey(primaryKey, keyExt == null ? UniqueKey.Category.Grain : UniqueKey.Category.KeyExtGrain, typeCode, keyExt))); }
private static unsafe LegacyGrainId FromGrainIdInternal(GrainId id) { var typeSpan = id.Type.AsSpan(); int prefixLength; if (typeSpan.StartsWith(GrainTypePrefix.LegacyGrainPrefixBytes.Span)) { prefixLength = GrainTypePrefix.LegacyGrainPrefixBytes.Length; } else { return(null); } ulong typeCodeData; var typeCodeSlice = typeSpan.Slice(prefixLength); fixed(byte *typeCodeBytes = typeCodeSlice) { // TODO: noalloc var typeCodeString = Encoding.UTF8.GetString(typeCodeBytes, 16); if (!ulong.TryParse(typeCodeString, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out typeCodeData)) { return(null); } } ulong n0, n1; string keyExt; var keySpan = id.Key.Value.Span; fixed(byte *idBytes = keySpan) { const int fieldLength = 16; // TODO: noalloc var n0String = Encoding.UTF8.GetString(idBytes, fieldLength); if (!ulong.TryParse(n0String, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out n0)) { return(null); } // TODO: noalloc var n1String = Encoding.UTF8.GetString(idBytes + fieldLength, fieldLength); if (!ulong.TryParse(n1String, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out n1)) { return(null); } const int keySpanPrefixLength = fieldLength + fieldLength + 1; if (keySpan.Length > keySpanPrefixLength && idBytes[keySpanPrefixLength - 1] == (byte)'+') { // Take every byte after the '+' and interpret it as UTF8 keyExt = Encoding.UTF8.GetString(idBytes + keySpanPrefixLength, keySpan.Length - keySpanPrefixLength); } else { keyExt = default; } } return(new LegacyGrainId(UniqueKey.NewKey(n0, n1, typeCodeData, keyExt))); }