Skip to content

Commit

Permalink
nits
Browse files Browse the repository at this point in the history
  • Loading branch information
badrishc committed Feb 27, 2022
1 parent 9819bb3 commit 72bd490
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 30 deletions.
14 changes: 4 additions & 10 deletions cs/src/core/Allocator/AllocatorBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -687,14 +687,8 @@ internal void WriteAsync<TContext>(IntPtr alignedSourceAddress, ulong alignedDes
/// </summary>
/// <param name="beginAddress">Begin address</param>
/// <param name="endAddress">End address</param>
internal abstract void MemoryPageLockEvictionScan(long beginAddress, long endAddress);

/// <summary>
/// Scan page guaranteed to be in memory
/// </summary>
/// <param name="beginAddress">Begin address</param>
/// <param name="endAddress">End address</param>
internal abstract void MemoryPageScan(long beginAddress, long endAddress);
/// <param name="observer">Observer of scan</param>
internal abstract void MemoryPageScan(long beginAddress, long endAddress, IObserver<IFasterScanIterator<Key, Value>> observer);
#endregion

/// <summary>
Expand Down Expand Up @@ -1282,8 +1276,8 @@ private void OnPagesClosed(long newSafeHeadAddress)
long start = oldSafeHeadAddress > closePageAddress ? oldSafeHeadAddress : closePageAddress;
long end = newSafeHeadAddress < closePageAddress + PageSize ? newSafeHeadAddress : closePageAddress + PageSize;

MemoryPageLockEvictionScan(start, end);
MemoryPageScan(start, end);
if (OnLockEvictionObserver != null) MemoryPageScan(start, end, OnLockEvictionObserver);
if (OnEvictionObserver != null) MemoryPageScan(start, end, OnEvictionObserver);

if (newSafeHeadAddress < closePageAddress + PageSize)
{
Expand Down
7 changes: 1 addition & 6 deletions cs/src/core/Allocator/BlittableAllocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -339,12 +339,7 @@ public override IFasterScanIterator<Key, Value> Scan(long beginAddress, long end
}

/// <inheritdoc />
internal override void MemoryPageLockEvictionScan(long beginAddress, long endAddress) => MemoryPageScan(beginAddress, endAddress, OnLockEvictionObserver);

/// <inheritdoc />
internal override void MemoryPageScan(long beginAddress, long endAddress) => MemoryPageScan(beginAddress, endAddress, OnEvictionObserver);

private void MemoryPageScan(long beginAddress, long endAddress, IObserver<IFasterScanIterator<Key, Value>> observer)
internal override void MemoryPageScan(long beginAddress, long endAddress, IObserver<IFasterScanIterator<Key, Value>> observer)
{
using var iter = new BlittableScanIterator<Key, Value>(this, beginAddress, endAddress, ScanBufferingMode.NoBuffering, epoch, true);
observer?.OnNext(iter);
Expand Down
7 changes: 1 addition & 6 deletions cs/src/core/Allocator/GenericAllocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1030,12 +1030,7 @@ public override IFasterScanIterator<Key, Value> Scan(long beginAddress, long end
}

/// <inheritdoc />
internal override void MemoryPageLockEvictionScan(long beginAddress, long endAddress) => MemoryPageScan(beginAddress, endAddress, OnLockEvictionObserver);

/// <inheritdoc />
internal override void MemoryPageScan(long beginAddress, long endAddress) => MemoryPageScan(beginAddress, endAddress, OnEvictionObserver);

private void MemoryPageScan(long beginAddress, long endAddress, IObserver<IFasterScanIterator<Key, Value>> observer)
internal override void MemoryPageScan(long beginAddress, long endAddress, IObserver<IFasterScanIterator<Key, Value>> observer)
{
var page = (beginAddress >> LogPageSizeBits) % BufferSize;
long pageStartAddress = beginAddress & ~PageSizeMask;
Expand Down
7 changes: 1 addition & 6 deletions cs/src/core/Allocator/VarLenBlittableAllocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -463,12 +463,7 @@ public override IFasterScanIterator<Key, Value> Scan(long beginAddress, long end
}

/// <inheritdoc />
internal override void MemoryPageLockEvictionScan(long beginAddress, long endAddress) => MemoryPageScan(beginAddress, endAddress, OnLockEvictionObserver);

/// <inheritdoc />
internal override void MemoryPageScan(long beginAddress, long endAddress) => MemoryPageScan(beginAddress, endAddress, OnEvictionObserver);

private void MemoryPageScan(long beginAddress, long endAddress, IObserver<IFasterScanIterator<Key, Value>> observer)
internal override void MemoryPageScan(long beginAddress, long endAddress, IObserver<IFasterScanIterator<Key, Value>> observer)
{
using var iter = new VariableLengthBlittableScanIterator<Key, Value>(this, beginAddress, endAddress, ScanBufferingMode.NoBuffering, epoch, true);
observer?.OnNext(iter);
Expand Down
3 changes: 1 addition & 2 deletions cs/src/core/Index/Common/AddressInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public unsafe struct AddressInfo

public static void WriteInfo(AddressInfo* info, long address, long size)
{
info->word = default(IntPtr);
info->word = default;
info->Address = address;
info->Size = size;
}
Expand Down Expand Up @@ -80,7 +80,6 @@ readonly get
}
set
{
var orig_word = word;
var _word = (long)word;
_word &= ~kAddressMask;
_word |= (value & kAddressMask);
Expand Down

0 comments on commit 72bd490

Please sign in to comment.