public class DirectBufferStrategy extends DiskBackedBufferStrategy
ByteBuffer
as a write through
cache and writes through to disk for persistence.BufferMode.Direct
opener
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 |
---|---|
boolean |
isFullyBuffered()
True iff the store is fully buffered (all reads are against memory).
|
void |
setNextOffset(long lastOffset)
Not needed for directBuffers
|
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)
Extends the basic behavior to write through to the backing file.
|
close, delete, deleteResources, force, getChannel, getFile, getHeaderSize, getRandomAccessFile, isStable, read, readRootBlock, transferTo, writeRootBlock
getBufferView, getCounters, getExtent, getUserExtent
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, useChecksums
destroy, getResourceMetadata, getUUID, isOpen, isReadOnly, size
getByteCount, getOffset, getPhysicalAddress, toAddr, toString
getInputStream, getOutputStream
public boolean isFullyBuffered()
IRawStore
Note: This does not guarantee that the OS will not swap the buffer onto disk.
public long write(ByteBuffer data)
Note: ClosedChannelException
can be thrown out of this method.
This exception is an indication that the backing channel was closed while
a writer was still running.
Note: ClosedByInterruptException
can be thrown out of this method
(wrapped as a RuntimeException
). This exception is an indication
that a writer was interrupted. This will occur if you are using
ExecutorService.shutdownNow()
on a service that is running one or
more writers. In such cases this should not be considered an error but
the expected result of interrupting the writer.
However, note that ClosedByInterruptException
means that the
channel was actually closed when the writer was
interrupted. This means that you basically can not interrupt running
writers without having to re-open the channel.
write
in interface IRawStore
write
in class BasicBufferStrategy
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 void truncate(long newExtent)
BasicBufferStrategy
AbstractBufferStrategy.overflow(long)
.truncate
in interface IBufferStrategy
truncate
in class BasicBufferStrategy
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 void setNextOffset(long lastOffset)
setNextOffset
in class DiskBackedBufferStrategy
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.