|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.rawstore.AbstractRawStore
com.bigdata.rawstore.AbstractRawWormStore
com.bigdata.journal.TemporaryRawStore
public class TemporaryRawStore
A non-restart-safe store for temporary data that buffers data in memory until
the write cache overflows (or is flushed to the disk) and then converts to a
disk-based store. The backing file (if any) is released when the temporary
store is close()d.
BufferMode.Temporary,
DiskOnlyStrategy| Field Summary |
|---|
| Fields inherited from class com.bigdata.rawstore.AbstractRawWormStore |
|---|
am |
| Fields inherited from interface com.bigdata.rawstore.IAddressManager |
|---|
NULL |
| Constructor Summary | |
|---|---|
TemporaryRawStore()
Create a TemporaryRawStore. |
|
TemporaryRawStore(int offsetBits)
Create a TemporaryRawStore. |
|
TemporaryRawStore(long maximumExtent,
int offsetBits,
File file)
Create a TemporaryRawStore with the specified configuration. |
|
| Method Summary | |
|---|---|
protected void |
assertOpen()
|
void |
close()
Close the store and delete the associated file, if any. |
void |
delete(long addr)
The default implementation is a NOP. |
void |
deleteResources()
Note: This operation is a NOP since close() always deletes the
backing file and deleteResources() requires that the store is
closed as a pre-condition. |
void |
destroy()
Simply delegates to close() since close() always
deletes the backing file for a temporary store. |
protected void |
finalize()
Closes the store if it gets GCd. |
void |
force(boolean metadata)
Force the data to stable storage. |
DiskOnlyStrategy |
getBufferStrategy()
|
CounterSet |
getCounters()
Return performance counters. |
File |
getFile()
The backing file -or- null if there is no backing file
for the store. |
int |
getMaxRecordSize()
The maximum length of a record that may be written on the store. |
IResourceMetadata |
getResourceMetadata()
Note: Temporary stores do not have persistent resource descriptions. |
protected static File |
getTempFile()
Return an empty File created using the temporary file name
mechanism. |
static File |
getTempFile(File tmpDir)
Return an empty File created using the temporary file name
mechanism in the specified directory. |
UUID |
getUUID()
The UUID of this TemporaryRawStore. |
boolean |
isFullyBuffered()
Return false since the temporary store is (at least in
principle) backed by disk. |
boolean |
isOpen()
true iff the store is open. |
boolean |
isReadOnly()
true iff the store does not allow writes. |
boolean |
isStable()
Always returns false since the store will be deleted as soon
as it is closed. |
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). |
String |
toString()
|
long |
write(ByteBuffer data)
Write the data (unisolated). |
| Methods inherited from class com.bigdata.rawstore.AbstractRawWormStore |
|---|
getAddressManager, getByteCount, getOffset, getOffsetBits, getPhysicalAddress, toAddr, toString |
| Methods inherited from class com.bigdata.rawstore.AbstractRawStore |
|---|
abortContext, delete, detachContext, write, write, write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public TemporaryRawStore()
TemporaryRawStore.
public TemporaryRawStore(int offsetBits)
TemporaryRawStore.
offsetBits - This determines the capacity of the store file and the maximum
length of a record. The value is passed through to
WormAddressManager.WormAddressManager(int).
public TemporaryRawStore(long maximumExtent,
int offsetBits,
File file)
TemporaryRawStore with the specified configuration.
maximumExtent - The maximum extent allowed for the TemporaryRawStore
-or- ZERO (0L) iff no limit should be imposed.offsetBits - This determines the capacity of the store file and the maximum
length of a record. The value is passed through to
WormAddressManager.WormAddressManager(int).file - The name of the backing file. The file will be created on
demand if it does not exist. It will be an error if the file
exists and has a non-zero size at that time. The file will be
registered with the JVM for for "delete on exit" and will be
deleted regardless as soon as the store is
closed.| Method Detail |
|---|
protected static File getTempFile()
File created using the temporary file name
mechanism. The file name will begin with bigdata and end
with .tmp. The file is marked for eventual deletion.
public static File getTempFile(File tmpDir)
File created using the temporary file name
mechanism in the specified directory. The directory will be created if it
does not exist and the caller has sufficient permissions. The file name
will begin with bigdata and end with .tmp. The
file is marked for eventual deletion.
tmpDir - The directory within which to create the temporary file.public final UUID getUUID()
TemporaryRawStore. This is reported as part of
getResourceMetadata() and may also be used to ensure that
ILocatableResources created on a TemporaryStore are
placed within a unique namespace.
getUUID in interface IRawStore
protected void finalize()
throws Throwable
finalize in class ObjectThrowablepublic String toString()
toString in class Objectpublic final File getFile()
IRawStorenull if there is no backing file
for the store.
getFile in interface IRawStorepublic void close()
close in interface IRawStorepublic void deleteResources()
close() always deletes the
backing file and deleteResources() requires that the store is
closed as a pre-condition.
deleteResources in interface IRawStorepublic final IResourceMetadata getResourceMetadata()
getResourceMetadata in interface IRawStorepublic final DiskOnlyStrategy getBufferStrategy()
public final void destroy()
close() since close() always
deletes the backing file for a temporary store.
destroy in interface IRawStoreIRawStore.deleteResources()public final void force(boolean metadata)
IRawStore
force in interface IRawStoremetadata - If true, then force both the file contents and the file
metadata to disk.public final long size()
IRawStore
size in interface IRawStoreprotected final void assertOpen()
public final boolean isOpen()
IRawStoretrue iff the store is open.
isOpen in interface IRawStoretrue iff the store is open.public final boolean isReadOnly()
IRawStoretrue iff the store does not allow writes.
isReadOnly in interface IRawStorepublic final boolean isStable()
false since the store will be deleted as soon
as it is closed.
isStable in interface IRawStorepublic final boolean isFullyBuffered()
false since the temporary store is (at least in
principle) backed by disk.
isFullyBuffered in interface IRawStorepublic final ByteBuffer read(long addr)
IRawStore
read in interface IRawStoreaddr - 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 final long write(ByteBuffer data)
IRawStore
write in interface IRawStoredata - 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 final int getMaxRecordSize()
public CounterSet getCounters()
ICounterSetAccess
getCounters in interface ICounterSetAccesspublic void delete(long addr)
AbstractRawStore
delete in interface IRawStoredelete in class AbstractRawStoreaddr - A long integer formed using Addr that encodes both the
offset at which the data was written and the #of bytes that
were written.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||