public class TemporaryRawStore extends AbstractRawWormStore implements IMRMW
close()
d.BufferMode.Temporary
,
DiskOnlyStrategy
am
NULL
Constructor and Description |
---|
TemporaryRawStore()
Create a
TemporaryRawStore . |
TemporaryRawStore(int offsetBits)
Create a
TemporaryRawStore . |
TemporaryRawStore(long maximumExtent,
int offsetBits,
File file)
Create a
TemporaryRawStore with the specified configuration. |
Modifier and Type | Method and Description |
---|---|
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()
|
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).
|
getAddressManager, getByteCount, getOffset, getOffsetBits, getPhysicalAddress, toAddr, toString
getInputStream, getOutputStream
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
.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
ILocatableResource
s created on a TemporaryStore
are
placed within a unique namespace.protected void finalize() throws Throwable
public final File getFile()
IRawStore
null
if there is no backing file
for the store.public void close()
public void deleteResources()
close()
always deletes the
backing file and deleteResources()
requires that the store is
closed as a pre-condition.deleteResources
in interface IRawStore
public final IResourceMetadata getResourceMetadata()
getResourceMetadata
in interface IRawStore
public final DiskOnlyStrategy getBufferStrategy()
public final void destroy()
destroy
in interface IRawStore
IRawStore.deleteResources()
public final void force(boolean metadata)
IRawStore
public final long size()
IRawStore
protected final void assertOpen()
public final boolean isOpen()
IRawStore
true
iff the store is open.public final boolean isReadOnly()
IRawStore
true
iff the store does not allow writes.isReadOnly
in interface IRawStore
public final boolean isStable()
false
since the store will be deleted as soon
as it is closed.public final boolean isFullyBuffered()
false
since the temporary store is (at least in
principle) backed by disk.isFullyBuffered
in interface IRawStore
public final ByteBuffer read(long addr)
IRawStore
read
in interface 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 final long write(ByteBuffer data)
IRawStore
write
in interface 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 final int getMaxRecordSize()
public CounterSet getCounters()
ICounterSetAccess
getCounters
in interface ICounterSetAccess
public void delete(long addr)
AbstractRawStore
delete
in interface IRawStore
delete
in class AbstractRawStore
addr
- A long integer formed using Addr
that encodes both the
offset at which the data was written and the #of bytes that
were written.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.