public interface IStorageUtility<E extends Externalizable>
| Modifier and Type | Method and Description |
|---|---|
int |
add(E e)
Add a new record to the store.
|
void |
close()
Close all resources associated with this StorageUtility.
|
void |
destroy()
Delete the storage utility itself, along with all stored records and meta-data
|
boolean |
exists(int id)
Return whether a record exists in the store
|
Object |
getAccessLock()
Fetch the object that acts as the synchronization lock for this StorageUtility
|
int |
getNumRecords()
Return the number of records in the store
|
int |
getRecordSize(int id)
Get the size of a record
|
int |
getTotalSize()
Return total size of device storage consumed by this StorageUtility
|
boolean |
isEmpty()
Return whether the store is empty
|
IStorageIterator<E> |
iterate()
Return an iterator to iterate through all records in this store
|
E |
read(int id)
Read and return the record corresponding to 'id'.
|
byte[] |
readBytes(int id)
Read and return the raw bytes for the record corresponding to 'id'.
|
void |
remove(int id)
Remove record with the given ID from the store.
|
void |
remove(Persistable p)
Remove object from the store
|
void |
removeAll() |
List<Integer> |
removeAll(EntityFilter ef) |
void |
repack()
Perform any clean-up/consolidation of the StorageUtility's underlying datastructures that is too expensive to do during
normal usage (e.g., if all the records are scattered among 10 half-empty RMSes, repack them into 5 full RMSes)
|
void |
repair()
If the StorageUtility has been left in a corrupt/inconsistent state, restore it to a non-corrupt state, even if it results
in data loss.
|
void |
setReadOnly() |
void |
update(int id,
E e)
Update a record in the store.
|
void |
write(Persistable p)
Write an object to the store.
|
E read(int id)
id - id of the objectbyte[] readBytes(int id)
id - id of the objectvoid write(Persistable p) throws StorageFullException
p - object to storeStorageFullException - if there is not enough room to store the objectint add(E e) throws StorageFullException
e - object to addStorageFullException - if not enough space availablevoid update(int id,
E e)
throws StorageFullException
id - ID of record to updatee - updated objectStorageFullException - if not enough space available to updateIllegalArgumentException - if no record exists for IDvoid remove(int id)
id - ID of record to removeIllegalArgumentException - if no record with that ID existsvoid remove(Persistable p)
p - object to removeIllegalArgumentException - if object is not in the storevoid removeAll()
List<Integer> removeAll(EntityFilter ef)
int getNumRecords()
boolean isEmpty()
boolean exists(int id)
id - record IDint getTotalSize()
int getRecordSize(int id)
id - record IDIllegalArgumentException - if no record exists for that IDIStorageIterator<E> iterate()
void close()
void destroy()
void repack()
void repair()
Object getAccessLock()
void setReadOnly()
Copyright © 2024. All rights reserved.