public bool Store(PropertyDatabaseRecord record, bool sync) { using (LockUpgradeableRead()) { var foundRecord = Find(record.recordKey, out var index); var insert = true; if (foundRecord) { var oldRecord = m_StoreData[(int)index]; if (oldRecord.IsValid()) { return(false); } insert = false; } using (LockWrite()) { if (insert) { m_StoreData.Insert((int)index, record); } else { m_StoreData[(int)index] = record; } return(true); } } }
void InvalidateRange(BinarySearchRange binarySearchRange) { using (LockWrite()) { for (var i = binarySearchRange.startOffset; i < binarySearchRange.endOffset; ++i) { var record = m_StoreData[(int)i]; var newRecord = new PropertyDatabaseRecord(record.recordKey, record.recordValue, false); m_StoreData[(int)i] = newRecord; } } }
void InvalidateMaskRange(BinarySearchRange binarySearchRange, ulong documentKeyMask) { using (LockWrite()) { for (var i = binarySearchRange.startOffset; i < binarySearchRange.endOffset; ++i) { var record = m_StoreData[(int)i]; if ((record.key.documentKey & documentKeyMask) != 0) { var newRecord = new PropertyDatabaseRecord(record.recordKey, record.recordValue, false); m_StoreData[(int)i] = newRecord; } } } }
public bool Store(PropertyDatabaseRecord record) { { if (!record.recordValue.valid) { return(false); } var success = m_MemoryStoreView.Store(record, !m_DelayedSync); if (success) { m_PropertyDatabase.StoresChanged(); } return(success); } }
void InvalidateRange(BinarySearchRange binarySearchRange, bool sync) { using (LockWrite()) { for (var i = binarySearchRange.startOffset; i < binarySearchRange.endOffset; ++i) { var record = GetRecord(i); var newRecord = new PropertyDatabaseRecord(record.recordKey, record.recordValue, false); WriteRecord(newRecord, i, false); } if (sync) { Sync(); } } }
PropertyDatabaseRecord GetRecord(long index) { if (m_Fs == null) { return(new PropertyDatabaseRecord()); } if (index < 0 || index >= length) { throw new ArgumentOutOfRangeException(nameof(index)); } var fileOffset = GetFileOffset((int)index); m_Fs.Seek(fileOffset, SeekOrigin.Begin); return(PropertyDatabaseRecord.FromBinary(m_Br)); }
public void Invalidate(PropertyDatabaseRecordKey recordKey, bool sync) { using (LockUpgradeableRead()) { var foundRecord = Find(recordKey, out var index); if (!foundRecord) { return; } using (LockWrite()) { var record = m_StoreData[(int)index]; var newRecord = new PropertyDatabaseRecord(record.recordKey, record.recordValue, false); m_StoreData[(int)index] = newRecord; } } }
void InvalidateMaskRange(BinarySearchRange binarySearchRange, ulong documentKeyMask, bool sync) { using (LockWrite()) { for (var i = binarySearchRange.startOffset; i < binarySearchRange.endOffset; ++i) { var record = GetRecord(i); if ((record.key.documentKey & documentKeyMask) != 0) { var newRecord = new PropertyDatabaseRecord(record.recordKey, record.recordValue, false); WriteRecord(newRecord, i, false); } } if (sync) { Sync(); } } }
void WriteRecord(PropertyDatabaseRecord record, long index, bool flush = true) { if (m_Fs == null) { return; } if (index < 0 || index >= length) { throw new ArgumentOutOfRangeException(nameof(index)); } var fileOffset = GetFileOffset((int)index); m_Bw.Seek(fileOffset, SeekOrigin.Begin); record.ToBinary(m_Bw); if (flush) { m_Fs.Flush(true); } }
public PropertyDatabaseMemoryStore ToMemoryStore() { using (LockRead()) { if (length == 0) { return(new PropertyDatabaseMemoryStore()); } var localStore = new List <PropertyDatabaseRecord>((int)length); for (var i = 0; i < length; ++i) { m_Fs.Seek(GetFileOffset(i), SeekOrigin.Begin); var record = PropertyDatabaseRecord.FromBinary(m_Br); localStore.Add(record); } return(new PropertyDatabaseMemoryStore(localStore)); } }
public bool Store(PropertyDatabaseRecord record, bool sync) { using (LockUpgradeableRead()) { var foundRecord = Find(record.recordKey, out var index); bool insert = !foundRecord; using (LockWrite()) { if (insert) { m_StoreData.Insert((int)index, record); } else { m_StoreData[(int)index] = record; } return(true); } } }
public void Invalidate(PropertyDatabaseRecordKey recordKey, bool sync) { using (LockUpgradeableRead()) { if (m_Fs == null) { return; } var foundRecord = Find(recordKey, out var index); if (!foundRecord) { return; } using (LockWrite()) { var record = GetRecord(index); var newRecord = new PropertyDatabaseRecord(record.recordKey, record.recordValue, false); WriteRecord(newRecord, index, sync); } } }
public bool Store(PropertyDatabaseRecord record, bool sync) { // Cannot add anything in this store throw new NotSupportedException(); }
public bool Store(PropertyDatabaseRecord record) { using (var view = GetView()) return(view.Store(record, true)); }
public bool Store(PropertyDatabaseRecord record, bool sync) { throw new NotSupportedException(); }