public interface IWriteCache
Modifier and Type | Method and Description |
---|---|
void |
close()
Permanently take the
IWriteCache out of service. |
void |
flush(boolean force)
Flush the writes to the backing channel but does not force anything to
the backing channel.
|
boolean |
flush(boolean force,
long timeout,
TimeUnit unit)
Flush the writes to the backing channel but does not force anything to
the backing channel.
|
ByteBuffer |
read(long offset,
int nbytes)
Read a record from the write cache.
|
void |
reset()
Reset the write cache, discarding any writes which have not been written
through to the backing channel yet.
|
boolean |
write(long offset,
ByteBuffer data,
int chk)
Write the record on the cache.
|
boolean write(long offset, ByteBuffer data, int chk) throws InterruptedException
offset
- The file offset of that record in the backing file.data
- The record. 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 cache (i.e., the data are copied into the cache).chk
- The checksum of the data (optional). When checksums are
not enabled this should be ZERO (0). When checksums are
enabled, #read(long)
will validate the checksum before
returning data.true
iff the caller's record was transferred to the
cache. When false
, there is not enough room left in
the write cache for this record.InterruptedException
IllegalStateException
- If the buffer is closed.IllegalArgumentException
- If the caller's record is larger than the maximum capacity of
cache (the record could not fit within the cache). The caller
should check for this and provide special handling for such
large records. For example, they can be written directly onto
the backing channel.ByteBuffer read(long offset, int nbytes) throws InterruptedException, ChecksumError
offset
- The file offset of that record in the backing file.nbytes
- The length of the record (decoded from the address by the
caller).null
iff the record does not lie
within the IWriteCache
. When non-null, this will be a
newly allocated exact fit mutable ByteBuffer
backed by a
Java byte[]
. The buffer will be flipped to prepare
for reading (the position will be zero and the limit will be the
#of bytes read). The data DOES NOT include the bytes used to code
checksum even when checksums are enabled.InterruptedException
IllegalStateException
- if the buffer is closed.ChecksumError
- if checksums are enabled and the checksum for the record
could not be validated.void flush(boolean force) throws IOException, InterruptedException
IOException
InterruptedException
- FIXME The [force] parameter is ignored and will be removed
shortly.boolean flush(boolean force, long timeout, TimeUnit unit) throws IOException, TimeoutException, InterruptedException
IOException
TimeoutException
InterruptedException
- FIXME The [force] parameter is ignored and will be removed
shortly.void reset() throws InterruptedException
IAtomicStore
level is responsible for
ensuring that processes do not see old data after an abort. This is
generally handled by re-loading the appropriate root block and
reinitializing various things from that root block.InterruptedException
void close() throws InterruptedException
IWriteCache
out of service. Dirty records
are discarded, not flushed.InterruptedException
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.