public abstract class DiskBackedBufferStrategy extends BasicBufferStrategy implements IDiskBasedStrategy
BufferMode.Direct
, where we use explicit IO operations, and the
BufferMode.Mapped
, where we memory-map the image. Common features
shared by these implementations deal mainly with initialization of a new disk
image.Modifier and Type | Field and Description |
---|---|
protected IReopenChannel<FileChannel> |
opener
Used to re-open the
FileChannel in this class. |
extent, userExtent
bufferMode, commitOffset, ERR_ADDRESS_IS_NULL, ERR_ADDRESS_NOT_WRITTEN, ERR_BAD_RECORD_SIZE, ERR_BUFFER_EMPTY, ERR_BUFFER_NULL, ERR_BUFFER_OVERRUN, ERR_MAX_EXTENT, ERR_NOT_OPEN, ERR_OPEN, ERR_READ_ONLY, ERR_RECORD_LENGTH_ZERO, ERR_TRUNCATE, initialExtent, log, maximumExtent, nextOffset, WARN
am
NULL
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the file.
|
void |
delete(long addr)
The default is a NOP.
|
void |
deleteResources()
Deletes the backing file(s) (if any).
|
void |
force(boolean metadata)
Forces the data to disk.
|
FileChannel |
getChannel()
The channel used to read and write on the file.
|
File |
getFile()
The backing file.
|
int |
getHeaderSize()
The size of the file header in bytes.
|
RandomAccessFile |
getRandomAccessFile()
The object used to read and write on that file.
|
boolean |
isStable()
True iff backed by stable storage.
|
ByteBuffer |
read(long addr)
The backing file is fully buffered so it does not need to be open for a
read to succeed.
|
ByteBuffer |
readRootBlock(boolean rootBlock0)
Read the specified root block from the backing file.
|
void |
setNextOffset(long lastOffset)
Protocol support for HAWrite
|
long |
transferTo(RandomAccessFile out)
Note: This is synchronized so that concurrent writers must block during
this operation.
|
void |
writeRootBlock(IRootBlockView rootBlock,
ForceEnum forceOnCommit)
Write the root block onto stable storage (ie, flush it through to disk).
|
getBufferView, getCounters, getExtent, getUserExtent, truncate, write
abort, assertOpen, closeForWrites, commit, destroy, getBufferMode, getInitialExtent, getMaximumExtent, getMaxRecordSize, getMetaBitsAddr, getMetaStartAddr, getMinimumExtension, getNextOffset, getResourceMetadata, getUUID, isDirty, isOpen, isReadOnly, overflow, requiresCommit, size, transferFromDiskTo, useChecksums
getAddressManager, getByteCount, getOffset, getOffsetBits, getPhysicalAddress, toAddr, toString
getInputStream, getOutputStream
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
abort, closeForWrites, commit, getAddressManager, getBufferMode, getCounters, getExtent, getInitialExtent, getMaximumExtent, getMaxRecordSize, getMetaBitsAddr, getMetaStartAddr, getNextOffset, getOffsetBits, getUserExtent, isDirty, requiresCommit, truncate, useChecksums
destroy, getResourceMetadata, getUUID, isFullyBuffered, isOpen, isReadOnly, size, write
getByteCount, getOffset, getPhysicalAddress, toAddr, toString
getInputStream, getOutputStream
protected final IReopenChannel<FileChannel> opener
FileChannel
in this class.public final int getHeaderSize()
IDiskBasedStrategy
getHeaderSize
in interface IBufferStrategy
getHeaderSize
in interface IDiskBasedStrategy
public final File getFile()
IDiskBasedStrategy
getFile
in interface IDiskBasedStrategy
getFile
in interface IRawStore
public final RandomAccessFile getRandomAccessFile()
IDiskBasedStrategy
getRandomAccessFile
in interface IDiskBasedStrategy
public final FileChannel getChannel()
IDiskBasedStrategy
getChannel
in interface IDiskBasedStrategy
public final boolean isStable()
IRawStore
public void delete(long addr)
AbstractBufferStrategy
delete
in interface IRawStore
delete
in class AbstractBufferStrategy
addr
- A long integer formed using Addr
that encodes both the
offset at which the data was written and the #of bytes that
were written.public void force(boolean metadata)
public void close()
close
in interface IRawStore
close
in class BasicBufferStrategy
public void deleteResources()
IRawStore
deleteResources
in interface IRawStore
public ByteBuffer readRootBlock(boolean rootBlock0)
IBufferStrategy
readRootBlock
in interface IBufferStrategy
public void writeRootBlock(IRootBlockView rootBlock, ForceEnum forceOnCommit)
IBufferStrategy
writeRootBlock
in interface IBufferStrategy
rootBlock
- The root block. Which root block is indicated by
IRootBlockView.isRootBlock0()
.public long transferTo(RandomAccessFile out) throws IOException
BasicBufferStrategy
transferTo
in interface IBufferStrategy
transferTo
in class BasicBufferStrategy
out
- The file to which the buffer contents will be transferred.IOException
public ByteBuffer read(long addr)
FileChannel
if it has been closed asynchronously or
in response to an interrupt (that is, if we discover that the channel is
closed but AbstractBufferStrategy.isOpen()
still returns true).read
in interface IRawStore
read
in class BasicBufferStrategy
addr
- A long integer that encodes both the offset from which the
data will be read and the #of bytes to be read. See
IAddressManager.toAddr(int, long)
.public void setNextOffset(long lastOffset)
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.