/// <summary> /// Check capacity of SpanPool and allocate a new one if capacity is /// not sufficient. /// </summary> private Span <byte> GetSpan(int length) { if (_pool.Capacity < length) { _pool = new SpanPool <byte>(Math.Max(length * 2, _pool.Capacity * 2)); } return(_pool.GetSpan(length)); }
public LightningStore(string pathToFolder, string dbName) { _env = new LightningEnvironment(pathToFolder); _dbName = dbName; _env.MaxDatabases = 1; _env.Open(); _pool = new SpanPool <byte>(PoolSizeInBytes); }
public CoinController(BoundedInbox inbox, BoundedInbox outbox, ICoinStore store, IOutpointHash hash, ILog log = null, int shardIndex = -1) { _inbox = inbox; _outbox = outbox; _store = store; _hash = hash; _log = log; _shardIndex = shardIndex; _pool = new SpanPool <byte>(PoolSizeInBytes); _mre = new ManualResetEvent(false); }
public ChainController(IChainStore store, BoundedInbox inbox, BoundedInbox outbox, Action <ILineage> propagateLineage, ILog log = null) { _store = store; _inbox = inbox; _outbox = outbox; _propagateLineage = propagateLineage; _log = log; _pool = new SpanPool <byte>(GetBlockInfoResponse.SizeInBytes); _mre = new ManualResetEvent(false); RefreshAndPropagateLineage(); }
public ConnectionController(BoundedInbox dispatchInbox, ISocketLike socket, ClientId clientId, ILog log = null) { _dispatchInbox = dispatchInbox ?? throw new ArgumentNullException(nameof(dispatchInbox)); _outbox = new BoundedInbox(Constants.ConnectionControllerOutboxSize); _socket = socket ?? throw new ArgumentNullException(nameof(socket)); _clientId = clientId; _log = log; _bufferIn = new byte[Constants.MaxRequestSize]; _mre = new ManualResetEvent(false); _tokenSource = new CancellationTokenSource(); _requestsInProgress = 0; _responsePool = new SpanPool <byte>(ResponsePoolSize); _responseCountInPool = 0; }