public virtual LoadEntity ToSerializationFormat(bool convertBandToBandData) { LoadEntity loadEntity = this.CreateCopy(); loadEntity.ConsumedLoad.ConvertToSerializationMetrics(convertBandToBandData); return(loadEntity); }
public void AddChild(LoadEntity child) { lock (this.Children.GetSyncRoot <LoadEntity>()) { if (this.Children.All((LoadEntity le) => le.Guid != child.Guid)) { this.Children.Add(child); child.Parent = this; } } }
public override IEnumerable <LoadEntity> GetEntities(LoadContainer targetContainer) { List <LoadEntity> list = new List <LoadEntity>(base.SourceEntities); List <LoadEntity> list2 = new List <LoadEntity>(); IAllocationConstraint allocationConstraint = targetContainer.Constraint ?? new AnyLoadConstraint(); Random random = new Random(); while (list.Count > 0 && (long)list2.Count < this.totalNumberOfEntities) { int index = random.Next(list.Count); LoadEntity loadEntity = list[index]; if (allocationConstraint.Accept(loadEntity)) { list2.Add(loadEntity); } list.RemoveAt(index); } return(list2); }
private void PopulateDirectoryObjectFromIdentity(LoadEntity entity) { using (OperationTracker.Create(this.logger, "Re-hydrating directory object of type {0} on load entity.", new object[] { entity.DirectoryObjectIdentity.ObjectType })) { if (entity.DirectoryObjectIdentity != null) { try { entity.DirectoryObject = this.directory.GetDirectoryObject(entity.DirectoryObjectIdentity); } catch (LocalizedException exception) { this.logger.LogError(exception, "Failed to rehydrate object with identity '{0}'.", new object[] { entity.DirectoryObjectIdentity }); } } } }
public override IEnumerable<LoadEntity> GetEntities(LoadContainer targetContainer) { IAllocationConstraint allocationConstraint = targetContainer.Constraint ?? new AnyLoadConstraint(); List<LoadEntity> list = new List<LoadEntity>(base.SourceEntities); List<LoadEntity> list2 = new List<LoadEntity>(); ByteQuantifiedSize value = ByteQuantifiedSize.FromBytes(0UL); Random random = new Random(); while (list.Count > 0 && value < this.totalSize) { int index = random.Next(list.Count); LoadEntity loadEntity = list[index]; if (allocationConstraint.Accept(loadEntity)) { ByteQuantifiedSize byteQuantifiedSize = value + loadEntity.ConsumedLoad.GetSizeMetric(PhysicalSize.Instance); if (byteQuantifiedSize < this.totalSize) { list2.Add(loadEntity); value = byteQuantifiedSize; } } list.RemoveAt(index); } return list2; }
protected virtual bool IsAcceptedEntity(LoadEntity entity) { DirectoryMailbox directoryMailbox = entity.DirectoryObject as DirectoryMailbox; return(directoryMailbox != null && this.band.ContainsMailbox(directoryMailbox)); }
public bool Visit(LoadEntity entity) { this.PopulateDirectoryObjectFromIdentity(entity); return(true); }