示例#1
0
        void RegisterRecycledRecordsInEmptyRecordIndex()
        {
            var recyclingRecords = _recordsToRecycle.ToArray();

            //Recycling records may cause nodes from the empty record index to be recycled.
            //If this happesn, the _recordToRecycle list contains new records.
            while (recyclingRecords.Length > 0)
            {
                _recordsToRecycle.Clear();

                foreach (var address in recyclingRecords)
                {
                    var recordHeader = ReadRecordHeader(address);

                    var emptyRecordIndexKey = new EmptyRecordIndexKey
                    {
                        A = recordHeader.Address, S = recordHeader.AllocatedDataSize
                    };

                    UsingEmptyRecordIndex(() =>
                    {
                        this.EmptyRecordIndex.Register(
                            emptyRecordIndexKey,
                            recordHeader.Address);
                    });
                }

                recyclingRecords = _recordsToRecycle.ToArray();
            }
        }
示例#2
0
        void RegisterRecycledRecordsInEmptyRecordIndex()
        {
            var recyclingRecords = _recordsToRegisterEmptyRecordIndex.ToArray();

            if (recyclingRecords.Length > 0)
            {
                _recordsToRegisterEmptyRecordIndex.Clear();

                foreach (var address in recyclingRecords)
                {
                    var recordHeader = ReadRecordHeader(address);

                    var emptyRecordIndexKey = new EmptyRecordIndexKey {
                        A = recordHeader.Address, S = recordHeader.AllocatedDataSize
                    };

                    this.EmptyRecordIndex.Register(
                        emptyRecordIndexKey,
                        recordHeader.Address);
                }

                recyclingRecords = _recordsToRegisterEmptyRecordIndex.ToArray();
            }
        }