private async Task InitIndexPageAsync(bool createTocIfNotExists)
        {
            var exists = await AzurePageBlob.ExistsAsync();

            if (exists || createTocIfNotExists)
            {
                if (!exists)
                {
                    await AzurePageBlob.CreateIfNotExists();
                }

                await LoadTocAsync();
            }
        }
Пример #2
0
        private async Task <LastCompressedPageContract[]> ReadContractAsync()
        {
            if (!await _azurePageBlob.ExistsAsync())
            {
                return(Array.Empty <LastCompressedPageContract>());
            }

            try
            {
                var contract = await _azurePageBlob.ReadAndDeserializeAsProtobufAsync <LastCompressedPageContract[]>();

                return(contract ?? Array.Empty <LastCompressedPageContract>());
            }
            catch (Exception)
            {
                Console.WriteLine("Can not read LastCompressedPageStorage content. Initializing");
            }

            return(Array.Empty <LastCompressedPageContract>());
        }