Beispiel #1
0
        private async Task <IndexFat> LoadFatAsync(int length)
        {
            var buffer = new byte[length];

            await _storageFacade.DownloadRangeAsync(_blobName, buffer);

            return(JsonSerializer.Deserialize <IndexFat>(buffer));
        }
Beispiel #2
0
        private async Task <BufferPool> LoadBlocksAsync(IImmutableList <Block> blocks)
        {
            if (_initialized == null)
            {
                throw new InvalidOperationException("InitializeAsync hasn't been called");
            }

            var(start, end) = Block.GetInterval(blocks, _initialized.BlobBlocks);
            var buffer = BufferPool.Rent((int)(end - start));

            await _storageFacade.DownloadRangeAsync(
                _blobName,
                buffer.Buffer,
                start,
                end - start,
                _initialized.SnapshotTime);

            return(buffer);
        }
Beispiel #3
0
        private async Task <LogFat> LoadFatAsync(int length, string partitionPath)
        {
            var buffer = new byte[length];

            await _storageFacade.DownloadRangeAsync(_blobName, buffer);

            var logFat = JsonSerializer.Deserialize <LogFat>(buffer);

            if (logFat.PartitionPath != partitionPath)
            {
                throw new CosbakException(
                          $"Partition path changed from {logFat.PartitionPath} to {partitionPath}");
            }

            return(logFat);
        }