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); }
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() }); }