示例#1
0
        public async ValueTask SaveAsync(IEnumerable <TopicAndQueuesSnapshotGrpcModel> snapshot)
        {
            await CreateIfNotExistsAsync();

            var dataToSave = new List <TopicAndQueuesBlobContract>();

            foreach (var topicData in snapshot)
            {
                var topicDataToSave = TopicAndQueuesBlobContract.Create(topicData);
                dataToSave.Add(topicDataToSave);
            }

            await _azurePageBlob.WriteAsProtobufAsync(dataToSave);
        }
示例#2
0
        public static TopicAndQueuesSnapshotGrpcModel ToGrpcContract(this TopicAndQueuesBlobContract src)
        {
            if (src == null)
            {
                return(null);
            }

            return(new TopicAndQueuesSnapshotGrpcModel
            {
                TopicId = src.TopicId,
                MessageId = src.MessageId,
                QueueSnapshots = src.Snapshots == null
                    ? Array.Empty <QueueSnapshotGrpcModel>()
                    : src.Snapshots.Select(itm => itm.ToGrpcContract()).ToArray()
            });
        }