private void CompleteObject(LargeObject obj)
        {
            // Get the blob reference id (reference to the fixed record list).
            long refId = obj.Id;

            lock (fixedList) {
                // Update the record in the fixed list.
                IArea block = fixedList.GetRecord(refId);

                // Record the position
                var recordPos = block.Position;

                // Read the information in the fixed record
                int status = block.ReadInt32();

                // Assert that the status is open
                if (status != 0)
                {
                    throw new IOException("Assertion failed: record is not open.");
                }

                int  refCount    = block.ReadInt32();
                long size        = block.ReadInt64();
                long currentSize = block.ReadInt64();
                long pageCount   = block.ReadInt64();

                try {
                    store.Lock();

                    block.Position = recordPos;
                    block.Write(1);                     // Status
                    block.Write(0);                     // Reference Count
                    block.Write(obj.CurrentSize);       // Final Size
                    block.Write(obj.CurrentSize);
                    block.Write(pageCount);             // Page Count
                    block.Flush();
                }
                finally {
                    store.Unlock();
                }
            }

            // Now the object has been finalized so change the state of the object
            obj.MarkComplete();
        }
예제 #2
0
        private void CompleteObject(LargeObject obj)
        {
            // Get the blob reference id (reference to the fixed record list).
            long refId = obj.Id.Id;

            lock (fixedList) {
                // Update the record in the fixed list.
                IArea block = fixedList.GetRecord(refId);

                // Record the position
                int recordPos = block.Position;
                // Read the information in the fixed record
                int status = block.ReadInt4();
                // Assert that the status is open
                if (status != 0)
                    throw new IOException("Assertion failed: record is not open.");

                int refCount = block.ReadInt4();
                long size = block.ReadInt8();
                long currentSize = block.ReadInt8();
                long pageCount = block.ReadInt8();

                try {
                    store.LockForWrite();

                    block.Position = recordPos;
                    block.WriteInt4(1);				// Status
                    block.WriteInt4(0);				// Reference Count
                    block.WriteInt8(obj.CurrentSize);	// Final Size
                    block.WriteInt8(obj.CurrentSize);
                    block.WriteInt8(pageCount);		// Page Count
                    block.Flush();
                } finally {
                    store.UnlockForWrite();
                }
            }

            // Now the object has been finalized so change the state of the object
            obj.MarkComplete();
        }