public ChatClientNetChannel(IActorSystem<IRoomActor> rooms, ICallbacksGatewayNode callbacksNode, INetNode node,  
     ITransportChannel transportChannel, IMessageSerializer serializer, ICoreEvents logger, INetNodeConfig config, IBufferPool bufferPool) 
     : base(node, transportChannel, serializer, logger, config, bufferPool)
 {
     _rooms = rooms;
     _callbacksNode = callbacksNode;
 }
 public AsyncProcessingNetChannel(Func<IMessageProcessingPipeBuilder, IMessageProcessingPipeBuilder> configureProcesssingPipe, INetNode node,
     ITransportChannel transportChannel, IMessageSerializer serializer, ICoreEvents logger, INetNodeConfig config, IBufferPool bufferPool)
     : base(node, transportChannel, serializer, logger, config, bufferPool)
 {
     _pipeBuilder = configureProcesssingPipe(new MessageProcessingPipeBuilder());
     _processor = _pipeBuilder.Build();
 }
Exemple #3
0
        public TsPesPacketPool(IBufferPool bufferPool)
        {
            if (null == bufferPool)
                throw new ArgumentNullException(nameof(bufferPool));

            _bufferPool = bufferPool;
        }
	    public StorageActionsAccessor(TableStorage storage, Reference<WriteBatch> writeBatch, Reference<SnapshotReader> snapshot, IdGenerator generator, IBufferPool bufferPool, OrderedPartCollection<AbstractFileCodec> fileCodecs)
            : base(snapshot, generator, bufferPool)
        {
            this.storage = storage;
            this.writeBatch = writeBatch;
	        this.fileCodecs = fileCodecs;
        }
 public GeneralStorageActions(TableStorage storage, Reference<WriteBatch> writeBatch, Reference<SnapshotReader> snapshot, IBufferPool bufferPool)
     : base(snapshot, bufferPool)
 {
     this.storage = storage;
     this.writeBatch = writeBatch;
     this.snapshot = snapshot;
 }
Exemple #6
0
        public TcpConnection(Socket socket, SocketSetting setting, IBufferPool receiveDataBufferPool, Action<ITcpConnection, byte[]> messageArrivedHandler, Action<ITcpConnection, SocketError> connectionClosedHandler)
        {
            Ensure.NotNull(socket, "socket");
            Ensure.NotNull(setting, "setting");
            Ensure.NotNull(receiveDataBufferPool, "receiveDataBufferPool");
            Ensure.NotNull(messageArrivedHandler, "messageArrivedHandler");
            Ensure.NotNull(connectionClosedHandler, "connectionClosedHandler");

            _socket = socket;
            _setting = setting;
            _receiveDataBufferPool = receiveDataBufferPool;
            _localEndPoint = socket.LocalEndPoint;
            _remotingEndPoint = socket.RemoteEndPoint;
            _messageArrivedHandler = messageArrivedHandler;
            _connectionClosedHandler = connectionClosedHandler;

            _sendSocketArgs = new SocketAsyncEventArgs();
            _sendSocketArgs.AcceptSocket = _socket;
            _sendSocketArgs.Completed += OnSendAsyncCompleted;

            _receiveSocketArgs = new SocketAsyncEventArgs();
            _receiveSocketArgs.AcceptSocket = socket;
            _receiveSocketArgs.Completed += OnReceiveAsyncCompleted;

            _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
            _framer = ObjectContainer.Resolve<IMessageFramer>();
            _framer.RegisterMessageArrivedCallback(OnMessageArrived);

            TryReceive();
            TrySend();
        }
 public QueueStorageActions(TableStorage tableStorage, IUuidGenerator generator, Reference<SnapshotReader> snapshot, Reference<WriteBatch> writeBatch, IBufferPool bufferPool)
     : base(snapshot, bufferPool)
 {
     this.tableStorage = tableStorage;
     this.writeBatch = writeBatch;
     this.generator = generator;
 }
Exemple #8
0
		public TableStorage(StorageEnvironmentOptions options, IBufferPool bufferPool)
		{
            if (options == null)
                throw new ArgumentNullException("options");

		    _options = options;
		    this.bufferPool = bufferPool;

            Debug.Assert(options != null);

//#if DEBUG
//			var directoryOptions = options as StorageEnvironmentOptions.DirectoryStorageEnvironmentOptions;
//
//			string debugJournalName;
//			if (directoryOptions != null)
//				debugJournalName = directoryOptions.TempPath.Replace(Path.DirectorySeparatorChar, '_').Replace(':','_');
//			else
//				debugJournalName = "InMemoryDebugJournal-" + Interlocked.Increment(ref debugJournalCount);
//
//			env = new StorageEnvironment(options, debugJournalName) {IsDebugRecording = true};
//#else
			env = new StorageEnvironment(options);
//#endif
			Initialize();
		}
Exemple #9
0
		public TableStorage(StorageEnvironment environment, IBufferPool bufferPool)
		{
			this.bufferPool = bufferPool;
			env = environment;

			Initialize();
		}
        public MappedResultsStorageActions(TableStorage tableStorage, IUuidGenerator generator, OrderedPartCollection<AbstractDocumentCodec> documentCodecs, Reference<SnapshotReader> snapshot, Reference<WriteBatch> writeBatch, IBufferPool bufferPool)
			: base(snapshot, bufferPool)
		{
			this.tableStorage = tableStorage;
			this.generator = generator;
			this.documentCodecs = documentCodecs;
			this.writeBatch = writeBatch;
		}
Exemple #11
0
 /// <summary>
 /// Initializes a new instance of the ServiceSocket class.
 /// </summary>
 /// <param name="socket">The .NET Socket object to encapsulate</param>
 /// <param name="IsPeerSocket">Indicates if this socket was spawned from the state server peer port</param>
 public ServiceSocket(Socket socket, bool IsPeerSocket, IBufferPool Buffers)
 {
     this.socket = socket;
     fromPeerListener = IsPeerSocket;
     sessionKey = null;
     id = Guid.NewGuid();
     bufferPool = Buffers;
 }
Exemple #12
0
		protected TableBase(string tableName, IBufferPool bufferPool)
		{
		    if (string.IsNullOrEmpty(tableName))
				throw new ArgumentNullException(tableName);

            BufferPool = bufferPool;
			TableName = tableName;
		}
		public TransactionalStorage(InMemoryRavenConfiguration configuration, Action onCommit)
		{
			this.configuration = configuration;
			this.onCommit = onCommit;
			documentCacher = new DocumentCacher(configuration);
			exitLockDisposable = new DisposableAction(() => Monitor.Exit(this));
            bufferPool = new BufferPool(configuration.Storage.Voron.MaxBufferPoolSize * 1024 * 1024 * 1024, int.MaxValue); // 2GB max buffer size (voron limit)
		}
Exemple #14
0
		public Table(string tableName, IBufferPool bufferPool, params string[] indexNames)
			: base(tableName, bufferPool)
		{
			tableIndexes = new ConcurrentDictionary<string, Index>();

			foreach (var indexName in indexNames)
				GetIndex(indexName);
		}
 public SocketRemotingServer(string name, IPEndPoint listeningEndPoint, SocketSetting setting = null)
 {
     _setting = setting ?? new SocketSetting();
     _receiveDataBufferPool = new BufferPool(_setting.ReceiveDataBufferSize, _setting.ReceiveDataBufferPoolSize);
     _serverSocket = new ServerSocket(listeningEndPoint, _setting, _receiveDataBufferPool, HandleRemotingRequest);
     _requestHandlerDict = new Dictionary<int, IRequestHandler>();
     _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(name ?? GetType().Name);
 }
        public IndexingStorageActions(TableStorage tableStorage, IUuidGenerator generator, Reference<SnapshotReader> snapshot, Reference<WriteBatch> writeBatch, IStorageActionsAccessor storageActionsAccessor, IBufferPool bufferPool)
			: base(snapshot, bufferPool)
		{
			this.tableStorage = tableStorage;
			this.generator = generator;
			this.writeBatch = writeBatch;
			this.currentStorageActionsAccessor = storageActionsAccessor;
		}
		public HttpListenerContextAdpater(HttpListenerContext ctx, InMemoryRavenConfiguration configuration, IBufferPool bufferPool)
		{
			this.ctx = ctx;
			this.configuration = configuration;
			this.bufferPool = bufferPool;
			ResponseInternal = new HttpListenerResponseAdapter(ctx.Response, bufferPool);
			RequestInternal = new HttpListenerRequestAdapter(ctx.Request);

			SetMaxAge();
		}
        public MappedResultsStorageActions(TableStorage tableStorage, IUuidGenerator generator, OrderedPartCollection<AbstractDocumentCodec> documentCodecs, Reference<SnapshotReader> snapshot, 
			Reference<WriteBatch> writeBatch, IBufferPool bufferPool, IStorageActionsAccessor storageActionsAccessor, ConcurrentDictionary<int, RemainingReductionPerLevel> ScheduledReductionsPerViewAndLevel)
			: base(snapshot, bufferPool)
		{
			this.tableStorage = tableStorage;
			this.generator = generator;
			this.documentCodecs = documentCodecs;
			this.writeBatch = writeBatch;
	        this.storageActionsAccessor = storageActionsAccessor;
	        this.scheduledReductionsPerViewAndLevel = ScheduledReductionsPerViewAndLevel;
		}
Exemple #19
0
        public TableStorage(StorageEnvironmentOptions options, IBufferPool bufferPool)
        {
            if (options == null)
                throw new ArgumentNullException("options");

            _options = options;
            this.bufferPool = bufferPool;

            env = new StorageEnvironment(_options);

            Initialize();
        }
		public TransactionalStorage(InMemoryRavenConfiguration configuration, Action onCommit, Action onStorageInaccessible)
		{
			this.configuration = configuration;
			this.onCommit = onCommit;
			this.onStorageInaccessible = onStorageInaccessible;

			RecoverFromFailedCompact(configuration.DataDirectory);

			documentCacher = new DocumentCacher(configuration);
			exitLockDisposable = new DisposableAction(() => Monitor.Exit(this));
            bufferPool = new BufferPool(configuration.Storage.Voron.MaxBufferPoolSize * 1024 * 1024 * 1024, int.MaxValue); // 2GB max buffer size (voron limit)
		}
Exemple #21
0
		public TableStorage(StorageEnvironmentOptions options, IBufferPool bufferPool)
		{
            if (options == null)
                throw new ArgumentNullException("options");

		    _options = options;
		    this.bufferPool = bufferPool;

            Debug.Assert(options != null);
            env = new StorageEnvironment(options);

			Initialize();
			CreateSchema();
		}		
Exemple #22
0
        protected MediaDumpBase(Action<IProgramStreams> programStreamsHandler)
        {
            _programStreamsHandler = programStreamsHandler;
            BufferPool = new BufferPool(new DefaultBufferPoolParameters
            {
                BaseSize = 5 * 64 * 1024,
                Pools = 2
            });

            PacketPool = new TsPesPacketPool(BufferPool);
            _bufferingManager = new NullBufferingManager(PacketPool);

            _streamReader = new SignalTask(ReadStreams);
        }
        public TsPacketizedElementaryStream(IBufferPool bufferPool, ITsPesPacketPool pesPacketPool, Action<TsPesPacket> packetHandler, TsStreamType streamType, uint pid)
        {
            if (null == bufferPool)
                throw new ArgumentNullException(nameof(bufferPool));
            if (null == pesPacketPool)
                throw new ArgumentNullException(nameof(pesPacketPool));

            _bufferPool = bufferPool;
            _pesPacketPool = pesPacketPool;

            _streamType = streamType;
            _pid = pid;

            _handler = packetHandler;
        }
Exemple #24
0
        public ServerSocket(IPEndPoint listeningEndPoint, SocketSetting setting, IBufferPool receiveDataBufferPool, Action<ITcpConnection, byte[], Action<byte[]>> messageArrivedHandler)
        {
            Ensure.NotNull(listeningEndPoint, "listeningEndPoint");
            Ensure.NotNull(setting, "setting");
            Ensure.NotNull(receiveDataBufferPool, "receiveDataBufferPool");
            Ensure.NotNull(messageArrivedHandler, "messageArrivedHandler");

            _listeningEndPoint = listeningEndPoint;
            _setting = setting;
            _receiveDataBufferPool = receiveDataBufferPool;
            _connectionEventListeners = new List<IConnectionEventListener>();
            _messageArrivedHandler = messageArrivedHandler;
            _socket = SocketUtils.CreateSocket(_setting.SendBufferSize, _setting.ReceiveBufferSize);
            _acceptSocketArgs = new SocketAsyncEventArgs();
            _acceptSocketArgs.Completed += AcceptCompleted;
            _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
        }
		public DocumentsStorageActions(IUuidGenerator uuidGenerator,
			OrderedPartCollection<AbstractDocumentCodec> documentCodecs,
			IDocumentCacher documentCacher,
			Reference<WriteBatch> writeBatch,
			Reference<SnapshotReader> snapshot,
            TableStorage tableStorage, 
            IBufferPool bufferPool)
			: base(snapshot, bufferPool)
		{
			this.uuidGenerator = uuidGenerator;
			this.documentCodecs = documentCodecs;
			this.documentCacher = documentCacher;
			this.writeBatch = writeBatch;
			this.tableStorage = tableStorage;

			metadataIndex = tableStorage.Documents.GetIndex(Tables.Documents.Indices.Metadata);
		}
        public AttachmentsStorageActions(Table attachmentsTable,
                                         Reference<WriteBatch> writeBatch, 
                                         Reference<SnapshotReader> snapshot, 
                                         IUuidGenerator uuidGenerator, 
                                         TableStorage tableStorage,
                                         Raven.Storage.Voron.TransactionalStorage transactionalStorage, 
                                         IBufferPool bufferPool)
            :base(snapshot, bufferPool)
        {
            this.attachmentsTable = attachmentsTable;
            this.writeBatch = writeBatch;
            this.uuidGenerator = uuidGenerator;
            this.tableStorage = tableStorage;
            this.transactionalStorage = transactionalStorage;

            metadataIndex = tableStorage.Attachments.GetIndex(Tables.Attachments.Indices.Metadata);
        }
Exemple #27
0
        public ClientSocket(EndPoint serverEndPoint, EndPoint localEndPoint, SocketSetting setting, IBufferPool receiveDataBufferPool, Action<ITcpConnection, byte[]> messageArrivedHandler)
        {
            Ensure.NotNull(serverEndPoint, "serverEndPoint");
            Ensure.NotNull(setting, "setting");
            Ensure.NotNull(receiveDataBufferPool, "receiveDataBufferPool");
            Ensure.NotNull(messageArrivedHandler, "messageArrivedHandler");

            _connectionEventListeners = new List<IConnectionEventListener>();

            _serverEndPoint = serverEndPoint;
            _localEndPoint = localEndPoint;
            _setting = setting;
            _receiveDataBufferPool = receiveDataBufferPool;
            _messageArrivedHandler = messageArrivedHandler;
            _waitConnectHandle = new ManualResetEvent(false);
            _socket = SocketUtils.CreateSocket(_setting.SendBufferSize, _setting.ReceiveBufferSize);
            _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
        }
        public SocketRemotingClient(EndPoint serverEndPoint, SocketSetting setting = null, EndPoint localEndPoint = null)
        {
            Ensure.NotNull(serverEndPoint, "serverEndPoint");

            _serverEndPoint = serverEndPoint;
            _localEndPoint = localEndPoint;
            _setting = setting ?? new SocketSetting();
            _receiveDataBufferPool = new BufferPool(_setting.ReceiveDataBufferSize, _setting.ReceiveDataBufferPoolSize);
            _clientSocket = new ClientSocket(_serverEndPoint, _localEndPoint, _setting, _receiveDataBufferPool, HandleReplyMessage);
            _responseFutureDict = new ConcurrentDictionary<long, ResponseFuture>();
            _replyMessageQueue = new BlockingCollection<byte[]>(new ConcurrentQueue<byte[]>());
            _responseHandlerDict = new Dictionary<int, IResponseHandler>();
            _connectionEventListeners = new List<IConnectionEventListener>();
            _scheduleService = ObjectContainer.Resolve<IScheduleService>();
            _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);

            RegisterConnectionEventListener(new ConnectionEventListener(this));
        }
Exemple #29
0
        public TsMediaParser(ITsDecoder tsDecoder, ITsPesPacketPool tsPesPacketPool, IBufferPool bufferPool, ITsTimestamp tsTimemestamp, IPesHandlers pesHandlers)
        {
            if (null == tsDecoder)
                throw new ArgumentNullException(nameof(tsDecoder));
            if (null == tsPesPacketPool)
                throw new ArgumentNullException(nameof(tsPesPacketPool));
            if (null == bufferPool)
                throw new ArgumentNullException(nameof(bufferPool));
            if (null == tsTimemestamp)
                throw new ArgumentNullException(nameof(tsTimemestamp));
            if (null == pesHandlers)
                throw new ArgumentNullException(nameof(pesHandlers));

            _tsPesPacketPool = tsPesPacketPool;
            _bufferPool = bufferPool;
            _tsDecoder = tsDecoder;
            _tsTimemestamp = tsTimemestamp;
            _pesHandlers = pesHandlers;
        }
        /// <summary>
        /// Adapts a <see cref="Stream"/> into a <see cref="IPipelineWriter"/>.
        /// </summary>
        /// <param name="stream"></param>
        /// <param name="pool"></param>
        /// <returns></returns>
        public static IPipelineWriter AsPipelineWriter(this Stream stream, IBufferPool pool)
        {
            var writer = new PipelineReaderWriter(pool);
            writer.CopyToAsync(stream).ContinueWith((task, state) =>
            {
                var innerWriter = (PipelineReaderWriter)state;

                if (task.IsFaulted)
                {
                    innerWriter.CompleteReader(task.Exception.InnerException);
                }
                else
                {
                    innerWriter.CompleteReader();
                }
            }, 
            writer, CancellationToken.None, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default);

            return writer;
        }
Exemple #31
0
 public GeneralStorageActions(TableStorage storage, Reference <WriteBatch> writeBatch, Reference <SnapshotReader> snapshot, IBufferPool bufferPool)
     : base(snapshot, bufferPool)
 {
     this.storage    = storage;
     this.writeBatch = writeBatch;
     this.snapshot   = snapshot;
 }
Exemple #32
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="SessionEventArgsBase" /> class.
 /// </summary>
 private SessionEventArgsBase(ProxyServer server)
 {
     BufferPool    = server.BufferPool;
     ExceptionFunc = server.ExceptionFunc;
     TimeLine["Session Created"] = DateTime.Now;
 }
Exemple #33
0
 public TasksStorageActions(TableStorage tableStorage, IUuidGenerator generator, Reference <SnapshotReader> snapshot, Reference <WriteBatch> writeBatch, IBufferPool bufferPool)
     : base(snapshot, bufferPool)
 {
     this.tableStorage = tableStorage;
     this.generator    = generator;
     this.writeBatch   = writeBatch;
 }
Exemple #34
0
 public IndexingStorageActions(TableStorage tableStorage, IUuidGenerator generator, Reference <SnapshotReader> snapshot, Reference <WriteBatch> writeBatch, IStorageActionsAccessor storageActionsAccessor, IBufferPool bufferPool)
     : base(snapshot, bufferPool)
 {
     this.tableStorage = tableStorage;
     this.generator    = generator;
     this.writeBatch   = writeBatch;
     this.currentStorageActionsAccessor = storageActionsAccessor;
 }