Example #1
0
        internal void SetTreePartitionContentsAndPin <T>(IReference <T> emptyPartitionRef, T contents) where T : IStorable
        {
            BaseReference baseReference = (BaseReference)emptyPartitionRef;

            m_partitionManager.TreeHasChanged = true;
            CacheItem(baseReference, contents, fromDeserialize: false, ItemSizes.SizeOf(contents));
            baseReference.PinValue();
            CacheSetValue(baseReference.Id, baseReference);
        }
Example #2
0
        protected BaseReference AllocateAndPin(IStorable obj, int initialSize)
        {
            Global.Tracer.Assert(obj != null, "Cannot allocate reference to null");
            BaseReference baseReference = CreateReference(obj);

            baseReference.Init(this, GenerateTempId());
            CacheItem(baseReference, obj, fromDeserialize: false, initialSize);
            baseReference.PinValue();
            return(baseReference);
        }
        private IReference <T> InternalAllocate <T>(T obj, int priority, bool startPinned, int initialSize) where T : IStorable
        {
            Global.Tracer.Assert(obj != null, "Cannot allocate reference to null");
            BaseReference baseReference = CreateReference(obj);

            baseReference.Init(this, m_offsetMap.GenerateTempId());
            CacheItem(baseReference, obj, priority, initialSize);
            if (startPinned)
            {
                baseReference.PinValue();
            }
            return((IReference <T>)baseReference);
        }