Exemple #1
0
        public DbItemReference Update(byte[] body, int transactionNumber)
        {
            var version = _versions.FirstOrDefault(v => IsVersionVisibleTo(v, transactionNumber));

            if (version != null)
            {
                var reference = _memoryManager.Allocate(body);

                if (version.CreateChangeNumber == transactionNumber)
                {
                    // we update the version created by this transaction
                    _memoryManager.Free(version.VersionReference);
                    version.VersionReference = reference;
                }
                else
                {
                    SetExpirationMarker(transactionNumber);

                    _versions.Add(new VersionInfo
                    {
                        CreateChangeNumber = transactionNumber,
                        ExpireChangeNumber = -1,
                        VersionReference   = reference
                    });
                }
                return(AllocateNew());
            }

            throw new WriteConflictException("Record has no visible versions");
        }
Exemple #2
0
 /// <summary>
 /// Release allocated value.
 /// </summary>
 /// <param name="reference">Reference to allocated value</param>
 public void Free(DbItemReference reference)
 {
     //if (IsVersioningEnabled)
     //{
     //    var record = new VersionedRecord(_memoryManager.Get(reference).RawData, _memoryManager, SnapshotData);
     //    record.Expire(DataTankerTransaction.Current.Id);
     //}
     //else
     _memoryManager.Free(reference);
 }
 public void Free(BlockPtr blockPtr)
 {
     _underlying.Free(blockPtr);
 }
Exemple #4
0
 public void Free(BlockPtr blockPtr)
 {
     _memoryManager.Free(blockPtr);
 }