public GangTokenService( IGangAuthenticationSettings settings, IGangSerializationService serializationService) { _serializationService = serializationService; _hasher = new HMACSHA256( Encoding.UTF8.GetBytes(settings.Secret) ); }
public GangCommandExecutor( IGangSerializationService serialization, IEnumerable <GangCommandHandler <TStateData> > handlers = null ) { _handlers = handlers ?.ToImmutableDictionary(h => h.DataType.GetCommandTypeName()) ?? ImmutableDictionary <string, GangCommandHandler <TStateData> > .Empty; _serialization = serialization; }
public FileSystemGangStoreFactory( IFileSystemGangStoreSettings settings, IGangSerializationService serializer, IMemoryCache cache ) { _settings = settings; _serializer = serializer; _cache = cache; }
public static byte[] SerializeCommandData( this IGangSerializationService service, object data, uint?replySequence = null) { if (data is null) { throw new ArgumentNullException(nameof(data)); } return(service.SerializeCommandData( data.GetType().GetCommandTypeName(), data, replySequence )); }
public GangController( IGangManager manager, string gangId, IGangMember member, GangMemberReceiveAsync receiveAsync, GangMemberSendAsync sendAsync, IGangSerializationService serializer ) { _gangId = gangId; Member = member; _manager = manager; _receiveAsync = receiveAsync; _sendAsync = sendAsync; _serializer = serializer; }
public static byte[] SerializeCommandData( this IGangSerializationService service, string type, object data, uint?replySequence = null) { if (data is null) { throw new ArgumentNullException(nameof(data)); } return(service.Serialize(new GangCommandWrapper( type, data, replySequence ))); }
public static byte[] SerializeCommand( this IGangSerializationService service, uint sequence, string type, object data, uint?replySequence = null) { if (data is null) { throw new ArgumentNullException(nameof(data)); } return(BitConverter.GetBytes(sequence) .Concat(service.SerializeCommandData( type, data, replySequence )) .ToArray()); }
public GangManager( ILogger <GangManager> logger, IGangSettings settings, GangCollection gangs, IGangControllerFactory controllerFactory, IGangSerializationService serializer, IGangManagerSequenceProvider sequence, GangEventExecutor <IGangManagerEvent> eventExecutor = null ) { _logger = logger; _settings = settings; _gangs = gangs; _controllerFactory = controllerFactory; _serializer = serializer; _sequence = sequence; _eventExecutor = eventExecutor; _events = new Subject <IGangManagerEvent>(); }
public FileSystemGangStore( IFileSystemGangStoreSettings settings, IGangSerializationService serializer, IMemoryCache cache, string name = null, IEnumerable <Func <TData, IEnumerable <object> > > indexers = null ) { _settings = settings; _serializer = serializer; _cache = cache; _ioTasks = new TaskQueue(); _indexers = indexers ?.ToImmutableArray() ?? ImmutableArray <Func <TData, IEnumerable <object> > > .Empty; Name = name; Directory.CreateDirectory(Path.GetDirectoryName(GetDataFilePath(null))); if (_indexers.Any()) { Directory.CreateDirectory(Path.GetDirectoryName(GetIndexFilePath(null))); } }
public GangStateStore( IGangSerializationService serializer, GangStateEventMap eventMap, IGangStoreFactory storeFactory ) { _events = new Subject <IGangStateEvent>(); _eventStore = storeFactory .For <GangStateEventWrapper>() .AddIndex(e => e.Audit.GangId) .Create(STORE_EVENTS); _sequenceNumberStore = storeFactory .For <uint>() .Create(STORE_EVENTS); _cache = storeFactory .For <object>() .Create(STORE_CACHE); _serializer = serializer; _eventMap = eventMap; _sequenceNumber = _sequenceNumberStore .TryGetAsync(KEY_SEQUENCE_NUMBER) .GetAwaiter().GetResult(); }
public GangControllerFactory( IGangSerializationService serializer) { _serializer = serializer; }
public static T Deserialize <T>( this IGangSerializationService service, byte[] value) { return((T)service.Deserialize(value, typeof(T))); }
public static TObject Map <TObject>( this IGangSerializationService service, object value) { return((TObject)service.Map(value, typeof(TObject))); }