public long Write(byte[] value)
        {
            lock (_lock)
            {
                var result = _writerChunk.Write(value);

                if (result == ChunkWriteResult.NotEnoughSpace)
                {
                    var chunkName = (ChunkName)null;
                    _writerChunk.Complete();
                    _writerChunk.Dispose();
                    chunkName    = _chunkNameManager.CreateNext();
                    _writerChunk = ReadWriteChunk.CreateNew(chunkName, _maxChunkSize, _protocol);
                    result       = _writerChunk.Write(value);
                }

                return(result.Position);
            }
        }
        private void InitWriterChunk()
        {
            var chunkName = default(ChunkName);

            if (!_chunkNameManager.TryGetLast(out chunkName))
            {
                chunkName    = _chunkNameManager.CreateNext();
                _writerChunk = ReadWriteChunk.CreateNew(chunkName, _maxChunkSize, _protocol);
            }
            else
            {
                _writerChunk = ReadWriteChunk.InitOnGoing(chunkName, _protocol);
            }

            if (_writerChunk.IsCompleted)
            {
                chunkName    = _chunkNameManager.CreateNext();
                _writerChunk = ReadWriteChunk.CreateNew(chunkName, _maxChunkSize, _protocol);
            }
        }