public class Volume extends Object
Represent the identity and optionally the service classes that manage a volume. A newly constructed Volume is "hollow" in the sense that it has no ability to perform I/O on a backing file or allocate pages. In this state it represents the identity, but not the content, of the volume.
To enable the Volume
to act on data, you must supply a
VolumeSpecification
object, either through the constructor or with
setSpecification(com.persistit.VolumeSpecification)
, and then call the open(Persistit)
method.
Modifier and Type | Method and Description |
---|---|
void |
close()
Release all resources for this
Volume and invalidate all its
buffers in the BufferPool . |
void |
close(long timeout)
Release all resources for this
Volume and invalidate all its
buffers in the BufferPool . |
boolean |
delete()
Delete the file backing this
Volume . |
boolean |
equals(Object o) |
File |
getAbsoluteFile()
Returns the absolute file by which this volume was opened.
|
Object |
getAppCache() |
long |
getExtendedPageCount() |
int |
getHandle() |
long |
getId() |
String |
getName() |
long |
getNextAvailablePage() |
int |
getPageSize() |
String |
getPath()
Returns the path name by which this volume was opened.
|
Tree |
getTree(String name,
boolean createIfNecessary)
Looks up by name and returns a
NewTree within this
Volume . |
String[] |
getTreeNames()
Returns an array of all currently defined
Tree names. |
int |
hashCode() |
boolean |
isClosed()
Indicate whether this
Volume has been closed. |
boolean |
isOpened()
Indicate whether this
Volume has been opened or created,
i.e., whether a backing volume file has been created or opened. |
boolean |
isReadOnly()
Indicate whether this
Volume prohibits updates. |
static boolean |
isValidPageSize(int pageSize) |
void |
setAppCache(Object appCache)
Store an Object with this Volume for the convenience of an application.
|
String |
toString() |
void |
truncate()
Remove all data from this volume.
|
public static boolean isValidPageSize(int pageSize)
public void close() throws PersistitException
Volume
and invalidate all its
buffers in the BufferPool
. Exchanges based on this
Volume
may no longer be used after this call. Waits up to
60000L milliseconds
for other threads to relinquish access to the volume.PersistitException
public void close(long timeout) throws PersistitException
Volume
and invalidate all its
buffers in the BufferPool
. Exchanges based on this
Volume
may no longer be used after this call.timeout
- Maximum time in milliseconds to wait for other threads to
relinquish access to the volume.PersistitException
public void truncate() throws PersistitException
Volume
except that it does not actually
delete and close the file. Instead, this method truncates the file,
rewrites the head page, and invalidates all buffers belonging to this
Volume
in the BufferPool
.PersistitException
public boolean delete() throws PersistitException
Volume
.true
if the file existed and was successfully
deleted.PersistitException
public String getPath()
public File getAbsoluteFile()
public long getNextAvailablePage()
Volume
public long getExtendedPageCount()
Volume
. Note that
this method reflects the current length of the volume file, but
on sparse file systems the disk space needed to store new pages
may not yet have been allocated.public int getPageSize()
Volume
.public Tree getTree(String name, boolean createIfNecessary) throws PersistitException
NewTree
within this
Volume
. If no such tree exists, this method either creates a
new tree or returns null depending on whether the
createIfNecessary
parameter is true
.name
- The tree namecreateIfNecessary
- Determines whether this method will create a new tree if there
is no tree having the specified name.NewTree
, or null
if
createIfNecessary
is false and there is no such tree
in this Volume
.PersistitException
public String[] getTreeNames() throws PersistitException
Tree
names.PersistitException
public boolean isOpened()
Volume
has been opened or created,
i.e., whether a backing volume file has been created or opened.true
if there is a backing volume file.public boolean isClosed()
Volume
has been closed.true
if this Volume is closed.public boolean isReadOnly()
Volume
prohibits updates.true
if this Volume prohibits updates.public String getName()
public long getId()
public void setAppCache(Object appCache)
appCache
- the object to be cached for application convenience.public Object getAppCache()
public int getHandle()
Copyright © 2025 Open Identity Platform Community. All rights reserved.