private void EnqueueItem(BaseReference itemRef)
 {
     AspNetCore.ReportingServices.ReportIntermediateFormat.Persistence.ObjectType objectType = itemRef.GetObjectType();
     if (objectType == AspNetCore.ReportingServices.ReportIntermediateFormat.Persistence.ObjectType.SubReportInstanceReference)
     {
         if (this.m_pinnedItems == null)
         {
             this.m_pinnedItems = new LinkedBucketedQueue <BaseReference>(25);
         }
         this.m_pinnedItems.Enqueue(itemRef);
     }
     else
     {
         ReferenceID id = itemRef.Id;
         if (!id.IsTemporary)
         {
             if (id.HasMultiPart && this.m_partitionManager.GetTreePartitionOffset(id) == TreePartitionManager.EmptyTreePartitionOffset)
             {
                 return;
             }
             this.m_cachePriority.Add(itemRef.Item);
             itemRef.InQueue = InQueueState.Exempt;
         }
     }
 }
Пример #2
0
        public void Deserialize(IntermediateFormatReader reader)
        {
            reader.RegisterDeclaration(StorageItem.m_declaration);
            while (reader.NextMember())
            {
                switch (reader.CurrentMember.MemberName)
                {
                case MemberName.Item:
                    base.Item = (IStorable)reader.ReadRIFObject();
                    break;

                case MemberName.Priority:
                    this.Priority = reader.ReadInt32();
                    break;

                case MemberName.ID:
                    this.Id = new ReferenceID(reader.ReadInt64());
                    break;

                default:
                    Global.Tracer.Assert(false);
                    break;
                }
            }
        }
Пример #3
0
 public override void Free(BaseReference reference)
 {
     if (!(reference == (object)null))
     {
         ReferenceID id          = reference.Id;
         StorageItem storageItem = default(StorageItem);
         if (this.CacheTryGetValue(id, out storageItem))
         {
             this.CacheRemoveValue(id);
         }
         if (storageItem == null)
         {
             storageItem = (StorageItem)reference.Item;
         }
         if (storageItem != null)
         {
             if (storageItem.InQueue == InQueueState.InQueue)
             {
                 this.m_cachePriority.Remove(storageItem);
             }
             int num = ItemSizes.SizeOf(storageItem);
             base.m_cacheSizeBytes    -= num;
             base.m_totalAuditedBytes -= num;
             base.m_totalFreedBytes   += num;
             base.UpdatePeakCacheSize();
             storageItem.Item = null;
             storageItem.UnlinkReferences(false);
         }
         reference.Item = null;
     }
 }
Пример #4
0
        public void Deserialize(IntermediateFormatReader reader)
        {
            reader.RegisterDeclaration(BaseReference.m_declaration);
            long num = 0L;

            while (reader.NextMember())
            {
                if (reader.CurrentMember.MemberName == MemberName.ID)
                {
                    num = reader.ReadInt64();
                }
                else
                {
                    Global.Tracer.Assert(false);
                }
            }
            BaseScalabilityCache baseScalabilityCache = reader.PersistenceHelper as BaseScalabilityCache;
            ScalabilityCacheType cacheType            = baseScalabilityCache.CacheType;

            if (num < 0 && cacheType != ScalabilityCacheType.GroupTree && cacheType != ScalabilityCacheType.Lookup)
            {
                PairObj <ReferenceID, BaseScalabilityCache> pairObj = (PairObj <ReferenceID, BaseScalabilityCache>)baseScalabilityCache.FetchStaticReference((int)num);
                this.m_id            = pairObj.First;
                baseScalabilityCache = pairObj.Second;
            }
            else
            {
                this.m_id = new ReferenceID(num);
            }
            this.SetScalabilityCache(baseScalabilityCache);
        }
        private void WriteItem(BaseReference itemRef)
        {
            ItemHolder  item  = itemRef.Item;
            IStorable   item2 = item.Item;
            ReferenceID id    = itemRef.Id;
            long        num   = base.m_storage.Allocate(item2);

            if (id.HasMultiPart && !id.IsTemporary)
            {
                this.m_partitionManager.UpdateTreePartitionOffset(id, num);
                if (itemRef.PinCount == 0)
                {
                    this.CacheRemoveValue(id);
                }
            }
            else
            {
                id              = new ReferenceID(num);
                id.IsTemporary  = false;
                id.HasMultiPart = false;
                itemRef.Id      = id;
            }
            if (itemRef.PinCount == 0)
            {
                item.Item      = null;
                item.Reference = null;
                itemRef.Item   = null;
            }
        }
 public void CacheSetValue(ReferenceID id, BaseReference value)
 {
     if (this.m_cacheLookup == null)
     {
         this.m_cacheLookup = new SegmentedDictionary <ReferenceID, BaseReference>(503, 17, ReferenceIDEqualityComparer.Instance);
     }
     this.m_cacheLookup[id] = value;
 }
Пример #7
0
 public StorageItem(ReferenceID id, int priority, IStorable item, int initialSize)
 {
     this.Priority      = priority;
     base.Item          = item;
     this.Offset        = -1L;
     this.Id            = id;
     this.PersistedSize = -1L;
     this.m_size        = this.CalculateSize(initialSize);
 }
        public bool CacheRemoveValue(ReferenceID id)
        {
            bool result = false;

            if (this.m_cacheLookup != null)
            {
                result = this.m_cacheLookup.Remove(id);
            }
            return(result);
        }
        public bool CacheTryGetValue(ReferenceID id, out BaseReference item)
        {
            item = null;
            bool result = false;

            if (this.m_cacheLookup != null)
            {
                result = this.m_cacheLookup.TryGetValue(id, out item);
            }
            return(result);
        }
Пример #10
0
        public override void ReferenceSerializeCallback(BaseReference reference)
        {
            ReferenceID id = reference.Id;

            if (id.IsTemporary)
            {
                StorageItem storageItem = (StorageItem)reference.Item;
                ReferenceID referenceID = this.m_offsetMap.GenerateId(id);
                if (id != referenceID)
                {
                    reference.Id   = referenceID;
                    storageItem.Id = referenceID;
                    this.CacheRemoveValue(id);
                }
                this.CacheSetValue(reference.Id, storageItem);
            }
        }
Пример #11
0
        public ReferenceID GenerateId(ReferenceID tempId)
        {
            ReferenceID result = tempId;

            if (tempId.IsTemporary)
            {
                if (this.m_nextIdPageSlot >= this.m_slotsPerPage)
                {
                    this.m_nextIdPageSlot = 0L;
                    this.m_nextIdPageNum += 1L;
                }
                long nextIdPageSlot = this.m_nextIdPageSlot;
                nextIdPageSlot        |= this.m_nextIdPageNum << this.m_idShift;
                result                 = new ReferenceID(nextIdPageSlot);
                this.m_nextIdPageSlot += 1L;
            }
            return(result);
        }
        private IStorable LoadItem(BaseReference reference)
        {
            if (base.m_inStreamOper)
            {
                Global.Tracer.Assert(false, "PartitionedTreeScalabilityCache should not Load during serialization");
            }
            IStorable storable = null;

            try
            {
                base.m_inStreamOper = true;
                base.m_deserializationTimer.Start();
                ReferenceID id = reference.Id;
                long        num;
                if (!id.IsTemporary && id.HasMultiPart)
                {
                    num = this.m_partitionManager.GetTreePartitionOffset(id);
                    if (num < 0)
                    {
                        return(null);
                    }
                }
                else
                {
                    num = reference.Id.Value;
                }
                if (num < 0)
                {
                    Global.Tracer.Assert(false, "Invalid offset for item.  ReferenceID: {0}, Offset: {1}", id, num);
                }
                long num2 = default(long);
                storable = (IStorable)base.m_storage.Retrieve(num, out num2);
            }
            finally
            {
                base.m_inStreamOper = false;
                base.m_deserializationTimer.Stop();
            }
            this.CacheItem(reference, storable, true, ItemSizes.SizeOf(storable));
            return(storable);
        }
        public sealed override IStorable Retrieve(BaseReference reference)
        {
            if (reference.Item == null)
            {
                ReferenceID   id            = reference.Id;
                BaseReference baseReference = default(BaseReference);
                if (this.CacheTryGetValue(id, out baseReference) && baseReference.Item != null)
                {
                    IStorable item = baseReference.Item.Item;
                    this.CacheItem(reference, item, true, ItemSizes.SizeOf(item));
                }
                else
                {
                    this.LoadItem(reference);
                }
            }
            IStorable result = null;

            if (reference.Item != null)
            {
                result = reference.Item.Item;
            }
            return(result);
        }
Пример #14
0
        public void Flush(IStorage storage, IIndexStrategy indexStrategy)
        {
            bool isTemporary = this.Id.IsTemporary;

            if (isTemporary)
            {
                this.Id = indexStrategy.GenerateId(this.Id);
            }
            this.UnlinkReferences(isTemporary);
            if (this.Offset >= 0)
            {
                long num = storage.Update(this, this.Offset, this.PersistedSize);
                if (num != this.Offset)
                {
                    this.Offset = num;
                    indexStrategy.Update(this.Id, this.Offset);
                }
            }
            else
            {
                this.Offset = storage.Allocate(this);
                indexStrategy.Update(this.Id, this.Offset);
            }
        }
Пример #15
0
 public void Init(BaseScalabilityCache storageManager, ReferenceID id)
 {
     this.SetScalabilityCache(storageManager);
     this.m_id = id;
 }
Пример #16
0
        public void Update(ReferenceID id, long value)
        {
            IndexTablePage page = this.GetPage(id.Value);

            this.WriteValue(id.Value, page, value);
        }
Пример #17
0
        public long Retrieve(ReferenceID id)
        {
            IndexTablePage page = this.GetPage(id.Value);

            return(this.ReadValue(id.Value, page));
        }