private async Task PopulateServiceEntityAsync( ServiceEntity serviceEntity, CancellationToken cancellationToken) { // Get all partitions in this service ServicePartitionList partitionListResult = await FabricClientRetryHelper.ExecuteFabricActionWithRetryAsync( () => this.testContext.FabricClient.QueryManager.GetPartitionListAsync( serviceEntity.Service.ServiceName, null, this.requestTimeOut, cancellationToken), FabricClientRetryErrors.GetPartitionListFabricErrors.Value, this.timer.GetRemainingTime(), cancellationToken).ConfigureAwait(false); if (partitionListResult != null) { GetClusterStateSnapshotAction.PartitionCount += partitionListResult.Count; foreach (var partitionResultItem in partitionListResult) { var partitionEntity = serviceEntity.AddPartition(partitionResultItem); await this.PopulatePartitionEntityAsync(partitionEntity, cancellationToken).ConfigureAwait(false); } } }
// Create ServiceEntity from Query.Service and add it to this node. public ServiceEntity AddService(Service service) { ServiceEntity serviceEntity = new ServiceEntity(service, this); this.ServiceList.Add(serviceEntity); return(serviceEntity); }
public PartitionEntity(Partition partition, ServiceEntity serviceEntity) { this.Partition = partition; this.ParentServiceEntity = serviceEntity; if (partition is StatefulServicePartition) { var sfPartition = partition as StatefulServicePartition; this.IsStateful = true; this.TargetReplicaSetSize = sfPartition.TargetReplicaSetSize; this.MinReplicaSetSize = sfPartition.MinReplicaSetSize; } else { var slPartition = partition as StatelessServicePartition; this.IsStateful = false; this.TargetReplicaSetSize = slPartition.InstanceCount; this.MinReplicaSetSize = 1; } this.ReplicaList = new List <ReplicaEntity>(); }
// No throw // Returns non-null. public static Uri ServiceName(this ServiceEntity svcInfo) { return(DefaultOnNullException <Uri>( () => svcInfo.Service.ServiceName)); }