public class SimpleFileRawStore extends AbstractRawWormStore
TemporaryRawStore}, which provides a solution for temporary data
that begins with the benefits of a memory-resident buffer and then
converts to a disk-based store on overflow.
Modifier and Type | Field and Description |
---|---|
File |
file |
protected RandomAccessFile |
raf |
am
NULL
Constructor and Description |
---|
SimpleFileRawStore(File file,
String mode)
Open a store.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
This also releases the lock if any obtained by the constructor.
|
void |
deleteResources()
Deletes the backing file(s) (if any).
|
void |
destroy()
Closes the store immediately (if open) and deletes its persistent
resources.
|
void |
force(boolean metadata)
Force the data to stable storage.
|
CounterSet |
getCounters()
Return performance counters.
|
File |
getFile()
The backing file -or-
null if there is no backing file
for the store. |
IResourceMetadata |
getResourceMetadata()
A description of this store in support of the scale-out architecture.
|
UUID |
getUUID()
|
boolean |
isFullyBuffered()
True iff the store is fully buffered (all reads are against memory).
|
boolean |
isOpen()
true iff the store is open. |
boolean |
isReadOnly()
true iff the store does not allow writes. |
boolean |
isStable()
True iff backed by stable storage.
|
ByteBuffer |
read(long addr)
Read the data (unisolated).
|
long |
size()
The #of application data bytes written on the store (does not count any
headers or root blocks that may exist for the store).
|
long |
write(ByteBuffer data)
Write the data (unisolated).
|
getAddressManager, getByteCount, getOffset, getOffsetBits, getPhysicalAddress, toAddr, toString
delete, getInputStream, getOutputStream
public final File file
protected final RandomAccessFile raf
public SimpleFileRawStore(File file, String mode) throws IOException
file
- The name of the file to use as the backing store.mode
- The file open mode for
RandomAccessFile.RandomAccessFile(File, String)()
.IOException
public boolean isOpen()
IRawStore
true
iff the store is open.true
iff the store is open.public boolean isReadOnly()
IRawStore
true
iff the store does not allow writes.public boolean isStable()
IRawStore
public boolean isFullyBuffered()
IRawStore
Note: This does not guarantee that the OS will not swap the buffer onto disk.
public File getFile()
IRawStore
null
if there is no backing file
for the store.public IResourceMetadata getResourceMetadata()
IRawStore
public void close()
public void deleteResources()
IRawStore
public void destroy()
IRawStore
IllegalStateException
if the store
is already closed, but still deletes the backing resources.IRawStore.deleteResources()
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 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 void force(boolean metadata)
IRawStore
metadata
- If true, then force both the file contents and the file
metadata to disk.public long size()
IRawStore
public CounterSet getCounters()
ICounterSetAccess
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.