public abstract class BasicBufferStrategy extends AbstractBufferStrategy
BufferMode.Transient
implementation or a
BufferMode.Mapped
implementation, but the
BufferMode.Direct
implementation needs to also implement write
through to the disk.Modifier and Type | Field and Description |
---|---|
protected long |
extent
The current length of the backing file in bytes.
|
protected long |
userExtent
The size of the user data space in bytes.
|
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()
Releases the buffer.
|
protected ByteBuffer |
getBufferView(boolean readOnly) |
CounterSet |
getCounters()
FIXME Counters need to be added here for the
DirectBufferStrategy ,
MappedBufferStrategy , and TransientBufferStrategy . |
long |
getExtent()
The current size of the journal in bytes.
|
long |
getUserExtent()
The size of the user data extent in bytes.
|
ByteBuffer |
read(long addr)
Read the data (unisolated).
|
long |
transferTo(RandomAccessFile out)
Note: This is synchronized so that concurrent writers must block during
this operation.
|
void |
truncate(long newExtent)
Note: This is synchronized since it MAY be invoked directly while
concurrent writers are running and not just from
AbstractBufferStrategy.overflow(long) . |
long |
write(ByteBuffer data)
Write the data (unisolated).
|
abort, assertOpen, closeForWrites, commit, delete, 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
getAddressManager, getHeaderSize, getOffsetBits, readRootBlock, writeRootBlock
deleteResources, force, getFile, isFullyBuffered, isStable
getByteCount, getOffset, getPhysicalAddress, toAddr, toString
getInputStream, getOutputStream
protected long extent
protected long userExtent
protected ByteBuffer getBufferView(boolean readOnly)
readOnly
- public long getExtent()
IBufferStrategy
Options.INITIAL_EXTENT
.public long getUserExtent()
IBufferStrategy
Note: The size of the user extent is always generally smaller than the
value reported by IBufferStrategy.getExtent()
since the latter also reports the
space allocated to the journal header and root blocks.
public void close()
close
in interface IRawStore
close
in class AbstractBufferStrategy
public long write(ByteBuffer data)
IRawStore
data
- The data. The bytes from the current
Buffer.position()
to the
Buffer.limit()
will be written and the
Buffer.position()
will be advanced to the
Buffer.limit()
. The caller may subsequently
modify the contents of the buffer without changing the state
of the store (i.e., the data are copied into the store).IAddressManager
.public ByteBuffer read(long addr)
IRawStore
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 truncate(long newExtent)
AbstractBufferStrategy.overflow(long)
.newExtent
- The new extent of the journal. This value represent the total
extent of the journal, including any root blocks together with
the user extent.public long transferTo(RandomAccessFile out) throws IOException
out
- The file to which the buffer contents will be transferred.IOException
public CounterSet getCounters()
DirectBufferStrategy
,
MappedBufferStrategy
, and TransientBufferStrategy
.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.