Exemple #1
0
        public async ValueTask <IReadOnlyList <TopicAndQueuesSnapshotGrpcModel> > GetAsync()
        {
            var result = await _azurePageBlob.ReadAndDeserializeAsProtobufAsync <List <TopicAndQueuesBlobContract> >();

            foreach (var itm in result)
            {
                itm.Snapshots ??= Array.Empty <QueueSnapshotBlobContract>();
            }

            var snapshot = result.Select(itm => itm.ToGrpcContract()).ToList();

            return(snapshot);
        }
Exemple #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>());
        }