public interface IBufferStrategy extends IRawStore, IMRMW
Interface for implementations of a buffer strategy as identified by a
BufferMode
. This interface is designed to encapsulate the
specifics of reading and writing slots and performing operations to make
an atomic commit.
NULL
Modifier and Type | Method and Description |
---|---|
void |
abort()
A method that requires the implementation to discard its buffered write
set (if any).
|
void |
closeForWrites()
Seals the store against further writes and discards any write caches
since they will no longer be used.
|
void |
commit()
A method that removes assumptions of how a specific strategy commits
data.
|
IAddressManager |
getAddressManager() |
BufferMode |
getBufferMode()
The buffer mode supported by the implementation
|
CounterSet |
getCounters()
Return the performance counter hierarchy.
|
long |
getExtent()
The current size of the journal in bytes.
|
int |
getHeaderSize()
The size of the journal header, including MAGIC, version, and both root
blocks.
|
long |
getInitialExtent()
The initial extent.
|
long |
getMaximumExtent()
The maximum extent allowable before a buffer overflow operation will be
rejected.
|
int |
getMaxRecordSize() |
long |
getMetaBitsAddr()
The RWStrategy requires meta allocation info in the root block, this
method is the hook to enable access.
|
long |
getMetaStartAddr()
The RWStrategy requires meta allocation info in the root block, this
method is the hook to enable access.
|
long |
getNextOffset()
The next offset at which a data item would be written on the store as an
offset into the user extent.
|
int |
getOffsetBits() |
long |
getUserExtent()
The size of the user data extent in bytes.
|
boolean |
isDirty()
|
ByteBuffer |
readRootBlock(boolean rootBlock0)
Read the specified root block from the backing file.
|
boolean |
requiresCommit(IRootBlockView block)
A method that removes assumptions of how a specific strategy determines
whether a transaction commit is required.
|
long |
transferTo(RandomAccessFile out)
A block operation that transfers the serialized records (aka the written
on portion of the user extent) en mass from the buffer onto an output
file.
|
void |
truncate(long extent)
Either truncates or extends the journal.
|
boolean |
useChecksums()
Return
true if the store uses per-record checksums. |
void |
writeRootBlock(IRootBlockView rootBlock,
ForceEnum forceOnCommitEnum)
Write the root block onto stable storage (ie, flush it through to disk).
|
close, delete, deleteResources, destroy, force, getFile, getResourceMetadata, getUUID, isFullyBuffered, isOpen, isReadOnly, isStable, read, size, write
getByteCount, getOffset, getPhysicalAddress, toAddr, toString
getInputStream, getOutputStream
long getNextOffset()
BufferMode getBufferMode()
long getInitialExtent()
long getMaximumExtent()
Note: The semantics here differ from those defined by
Options.MAXIMUM_EXTENT
. The latter specifies the threshold at
which a journal will overflow (onto another journal) while this specifies
the maximum size to which a buffer is allowed to grow.
Note: This is normally zero (0L), which basically means that
the maximum extent is ignored by the IBufferStrategy
but
respected by the AbstractJournal
, resulting in a soft limit
on journal overflow.
0L
iff no limit is imposed.long getExtent()
Options.INITIAL_EXTENT
.long getUserExtent()
Note: The size of the user extent is always generally smaller than the
value reported by getExtent()
since the latter also reports the
space allocated to the journal header and root blocks.
int getHeaderSize()
void truncate(long extent)
Note: Implementations of this method MUST be synchronized so that the operation is atomic with respect to concurrent writers.
extent
- The new extent of the journal. This value represent the total
extent of the journal, including any root blocks together with
the user extent.IllegalArgumentException
- The user extent MAY NOT be increased beyond the maximum
offset for which the journal was provisioned by
Options.OFFSET_BITS
.void writeRootBlock(IRootBlockView rootBlock, ForceEnum forceOnCommitEnum)
rootBlock
- The root block. Which root block is indicated by
IRootBlockView.isRootBlock0()
.forceOnCommit
- Governs whether or not the journal is forced to stable storage
and whether or not the file metadata for the journal is forced
to stable storage. See Options.FORCE_ON_COMMIT
.ByteBuffer readRootBlock(boolean rootBlock0)
long transferTo(RandomAccessFile out) throws IOException
Note: Implementations of this method MUST be synchronized so that the operation is atomic with respect to concurrent writers.
out
- The file to which the buffer contents will be transferred.IOException
void closeForWrites()
IllegalStateException
- if the store is closed.IllegalStateException
- if the store is read-only.CounterSet getCounters()
getCounters
in interface ICounterSetAccess
IAddressManager getAddressManager()
boolean requiresCommit(IRootBlockView block)
block
- The root block held by the client, can be checked against the
state of the Buffer Strategyvoid commit()
void abort()
long getMetaStartAddr()
long getMetaBitsAddr()
int getOffsetBits()
int getMaxRecordSize()
boolean useChecksums()
true
if the store uses per-record checksums. When
true
, an additional 4 bytes are written after the record on
the disk. Those bytes contain the checksum of the record.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.