Esempio n. 1
0
        public ReplicationManager(ILogger <ReplicationManager> log, IRedisMultiplexer master, IRedisMultiplexer slave, IObservable <long> timer)
            : base("Replication")
        {
            if (timer == null)
            {
                throw new ArgumentNullException(nameof(timer));
            }

            this.log    = log ?? throw new ArgumentNullException(nameof(log));
            this.slave  = slave ?? throw new ArgumentNullException(nameof(slave));
            this.master = master ?? throw new ArgumentNullException(nameof(master));
            Progress    = timer.Select(TimerEvent);
        }
Esempio n. 2
0
        public async Task <IReplicationManager> StartReplicationFrom(IRedisMultiplexer master, IRedisMultiplexer slave)
        {
            if (master == null)
            {
                throw new ArgumentNullException(nameof(master));
            }

            if (slave == null)
            {
                throw new ArgumentNullException(nameof(slave));
            }

            var timer   = Observable.Interval(TimeSpan.FromSeconds(1), scheduler);
            var manager = new ReplicationManager(loggerFactory.CreateLogger <ReplicationManager>(), master, slave, timer);

            tracker?.Track(manager.Progress);
            await manager.Open().ConfigureAwait(false);

            return(manager);
        }
Esempio n. 3
0
        public RedisLink(ILoggerFactory loggerFactory,
                         IRedisConfiguration configuration,
                         IRedisMultiplexer multiplexer,
                         IResilience resilience,
                         IEntitySubscriber entitySubscriber,
                         IDataSerializer defaultSerialiser)
            : base(configuration?.ServiceName)
        {
            this.loggerFactory = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory));
            Multiplexer        = multiplexer ?? throw new ArgumentNullException(nameof(multiplexer));

            Resilience             = resilience ?? throw new ArgumentNullException(nameof(resilience));
            EntitySubscriber       = entitySubscriber;
            this.defaultSerialiser = defaultSerialiser ?? throw new ArgumentNullException(nameof(defaultSerialiser));
            log                     = loggerFactory.CreateLogger <RedisLink>();
            Generator               = new ScriptGenerator();
            IndexManager            = new MainIndexManager(new IndexManagerFactory(loggerFactory, this));
            Client                  = new RedisClient(loggerFactory?.CreateLogger <RedisClient>(), this, IndexManager);
            PersistencyRegistration = new PersistencyRegistrationHandler(loggerFactory, this);
        }