Esempio n. 1
0
		protected NodeBase(ICluster owner, IPEndPoint endpoint, IFailurePolicy failurePolicy, ISocket socket)
		{
			this.owner = owner;
			this.endpoint = endpoint;
			this.socket = socket;
			this.failurePolicy = failurePolicy;
			this.name = endpoint.ToString();

			failLock = new Object();
			writeQueue = new ConcurrentQueue<Data>();
			readQueue = new Queue<Data>();

			mustReconnect = true;
			IsAlive = true;

			counterEnqueuePerSec = Metrics.Meter("node write enqueue/sec", endpoint.ToString(), Interval.Seconds);
			counterDequeuePerSec = Metrics.Meter("node write dequeue/sec", endpoint.ToString(), Interval.Seconds);
			counterOpReadPerSec = Metrics.Meter("node op read/sec", endpoint.ToString(), Interval.Seconds);
			counterWriteQueue = Metrics.Counter("write queue length", endpoint.ToString());
			counterReadQueue = Metrics.Counter("read queue length", endpoint.ToString());

			counterWritePerSec = Metrics.Meter("node write/sec", endpoint.ToString(), Interval.Seconds);
			counterErrorPerSec = Metrics.Meter("node in error/sec", endpoint.ToString(), Interval.Seconds);
			counterItemCount = Metrics.Counter("commands", endpoint.ToString());
			gaugeSendSpeed = Metrics.Gauge("send speed", endpoint.ToString());
		}
Esempio n. 2
0
        protected NodeBase(ICluster owner, IPEndPoint endpoint, IFailurePolicy failurePolicy, ISocket socket)
        {
            this.owner         = owner;
            this.endpoint      = endpoint;
            this.socket        = socket;
            this.failurePolicy = failurePolicy;
            this.name          = endpoint.ToString();

            failLock   = new Object();
            writeQueue = new ConcurrentQueue <Data>();
            readQueue  = new Queue <Data>();

            mustReconnect = true;
            IsAlive       = true;

            counterEnqueuePerSec = Metrics.Meter("node write enqueue/sec", endpoint.ToString(), Interval.Seconds);
            counterDequeuePerSec = Metrics.Meter("node write dequeue/sec", endpoint.ToString(), Interval.Seconds);
            counterOpReadPerSec  = Metrics.Meter("node op read/sec", endpoint.ToString(), Interval.Seconds);
            counterWriteQueue    = Metrics.Counter("write queue length", endpoint.ToString());
            counterReadQueue     = Metrics.Counter("read queue length", endpoint.ToString());

            counterWritePerSec = Metrics.Meter("node write/sec", endpoint.ToString(), Interval.Seconds);
            counterErrorPerSec = Metrics.Meter("node in error/sec", endpoint.ToString(), Interval.Seconds);
            counterItemCount   = Metrics.Counter("commands", endpoint.ToString());
            gaugeSendSpeed     = Metrics.Gauge("send speed", endpoint.ToString());
        }
Esempio n. 3
0
 public MessageContextProcessor(
     Func <Message, CancellationToken, Task> processMessage,
     IFailurePolicy failurePolicy          = null,
     Func <Exception, bool> shouldComplete = null)
     : this(new DefaultMessageProcessor(processMessage), failurePolicy, shouldComplete)
 {
 }
 public void Init()
 {
     _messageReceiver  = Substitute.For <IMessageReceiver>();
     _messageSender    = Substitute.For <IMessageSender>();
     _failurePolicy    = Substitute.For <IFailurePolicy>();
     _messageProcessor = Substitute.For <IMessageProcessor>();
     _sut = new MessageContextProcessor(_messageProcessor, _failurePolicy, e => e is InvalidOperationException);
 }
Esempio n. 5
0
 public void Init()
 {
     _messageReceiver  = Substitute.For <IMessageReceiver>();
     _messageSender    = Substitute.For <IMessageSender>();
     _failurePolicy    = Substitute.For <IFailurePolicy>();
     _messageProcessor = Substitute.For <IMessageProcessor>();
     _sut = new MessageContextProcessor(_messageProcessor, _failurePolicy);
 }
		public MemcachedCluster(IEnumerable<IPEndPoint> endpoints, IBufferAllocator allocator,
			INodeLocator locator, IReconnectPolicy reconnectPolicy, IFailurePolicy failurePolicy,
			Func<ISocket> socketFactory)
			: base(endpoints, locator, reconnectPolicy)
		{
			this.allocator = allocator;
			this.failurePolicy = failurePolicy;
			this.socketFactory = socketFactory;
		}
Esempio n. 7
0
 public MessageContextProcessor(
     IMessageProcessor messageProcessor,
     IFailurePolicy failurePolicy          = null,
     Func <Exception, bool> shouldComplete = null)
 {
     _messageProcessor = messageProcessor ?? throw new ArgumentNullException(nameof(messageProcessor));
     _failurePolicy    = failurePolicy ?? new AbandonMessageFailurePolicy();
     _shouldComplete   = shouldComplete;
 }
Esempio n. 8
0
 public MemcachedCluster(IEnumerable <IPEndPoint> endpoints, IBufferAllocator allocator,
                         INodeLocator locator, IReconnectPolicy reconnectPolicy, IFailurePolicy failurePolicy,
                         Func <ISocket> socketFactory)
     : base(endpoints, locator, reconnectPolicy)
 {
     this.allocator     = allocator;
     this.failurePolicy = failurePolicy;
     this.socketFactory = socketFactory;
 }
Esempio n. 9
0
        protected NodeBase(ICluster owner, IPEndPoint endpoint, IFailurePolicy failurePolicy, ISocket socket)
        {
            this.owner         = owner;
            this.endpoint      = endpoint;
            this.socket        = socket;
            this.failurePolicy = failurePolicy;

            name       = endpoint.ToString();
            failLock   = new Object();
            writeQueue = new ConcurrentQueue <OpQueueEntry>();
            readQueue  = new Queue <OpQueueEntry>();

            mustReconnect = true;
            IsAlive       = true;

            npm = new NodePerformanceMonitor(name);
        }
Esempio n. 10
0
        protected NodeBase(ICluster owner, IPEndPoint endpoint, ISocket socket, IFailurePolicyFactory failurePolicyFactory)
        {
            this.owner    = owner ?? throw new ArgumentNullException(nameof(owner));
            this.endpoint = endpoint ?? throw new ArgumentNullException(nameof(endpoint));
            this.socket   = socket;

            name       = endpoint.ToString();
            failLock   = new object();
            writeQueue = new ConcurrentQueue <OpQueueEntry>();
            readQueue  = new Queue <OpQueueEntry>();

            IsAlive       = true;
            mustReconnect = true;

            flushWriteBufferAction  = FlushWriteBufferRequest;
            tryAskForMoreDataAction = TryAskForMoreDataRequest;
            failurePolicy           = (failurePolicyFactory ?? throw new ArgumentNullException(nameof(failurePolicyFactory))).Create(this);

            npm = new NodePerformanceMonitor(name);
        }
Esempio n. 11
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="messageProcessor"></param>
 /// <param name="failurePolicy"></param>
 public MessageContextProcessor(IMessageProcessor messageProcessor, IFailurePolicy failurePolicy = null)
 {
     _messageProcessor = messageProcessor ?? throw new ArgumentNullException(nameof(messageProcessor));
     _failurePolicy    = failurePolicy ?? new AbandonMessageFailurePolicy();
 }
 public MemcachedNode(IBufferAllocator allocator, ICluster owner, IPEndPoint endpoint, IFailurePolicy failurePolicy, ISocket socket)
     : base(owner, endpoint, failurePolicy, socket)
 {
     this.allocator = allocator;
 }
Esempio n. 13
0
 public void Init()
 {
     _sut = new DeferMessageFailurePolicy(ex => true);
 }
 public void Init()
 {
     _sut = new CloneMessageFailurePolicy(ex => ex is InvalidOperationException);
 }
Esempio n. 15
0
 public void Init()
 {
     _sut = new AbandonMessageFailurePolicy();
 }
		public MemcachedNode(IBufferAllocator allocator, ICluster owner, IPEndPoint endpoint, IFailurePolicy failurePolicy, ISocket socket)
			: base(owner, endpoint, failurePolicy, socket)
		{
			this.allocator = allocator;
		}