Class MappedPageSource
java.lang.Object
org.terracotta.offheapstore.disk.paging.MappedPageSource
- All Implemented Interfaces:
PageSource
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<Long, MappedPageSource.AllocatedRegion> private final PowerOfTwoFileAllocatorprivate static final Retryerprivate final ReopeningInterruptibleChannel<FileChannel> private final Fileprivate static final org.slf4j.Loggerprivate final IdentityHashMap<MappedPage, Long> private final RandomAccessFile -
Constructor Summary
ConstructorsConstructorDescriptionMappedPageSource(File file) MappedPageSource(File file, boolean truncate) MappedPageSource(File file, boolean truncate, long size) MappedPageSource(File file, long size) -
Method Summary
Modifier and TypeMethodDescriptionallocate(int size, boolean thief, boolean victim, OffHeapStorageArea owner) Attempt to allocate a page of the given size.allocateRegion(long size) claimPage(long address, long size) longclaimRegion(long address, long size) voidclose()voidflush()voidvoidfreeRegion(long address) longgetAddress(Page underlying) getFile()
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
ASYNC_FLUSH_EXECUTOR
-
file
-
raf
-
channel
-
allocator
-
pages
-
allocated
-
-
Constructor Details
-
MappedPageSource
- Throws:
IOException
-
MappedPageSource
- Throws:
IOException
-
MappedPageSource
- Throws:
IOException
-
MappedPageSource
- Throws:
IOException
-
-
Method Details
-
allocateRegion
-
freeRegion
public void freeRegion(long address) -
claimRegion
public long claimRegion(long address, long size) -
getReadableChannel
-
getWritableChannel
-
getFile
-
allocate
Description copied from interface:PageSourceAttempt to allocate a page of the given size.Allocations identified as thieves will if necessary 'steal' space from previous allocations identified as 'victims' in order to fulfill the allocation request.
owneris the area from which the returned page can subsequently be stolen or recovered. This is most likely to be the calling instance.- Specified by:
allocatein interfacePageSource- Parameters:
size- size of page to allocatethief-trueif the allocation can steal space from victimsvictim-trueif the allocated page should be eligible for stealingowner- owner from which subsequent steal should occur- Returns:
- an allocated page, or
nullin the case of failure
-
free
- Specified by:
freein interfacePageSource
-
claimPage
- Throws:
IOException
-
getAddress
-
flush
- Throws:
IOException
-
close
- Throws:
IOException
-