|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.tivoli.twg.util.DataStore
DataStore object.
Constructor Summary | |
---|---|
DataStore(java.lang.String fileName)
Constructor for DataStore : create default unopened R/W datastore |
|
DataStore(java.lang.String fileName,
boolean open)
Constructor for DataStore : create default R/W datastore |
|
DataStore(java.lang.String fileName,
int userSignature,
boolean open,
boolean readOnly)
Constructor for DataStore : create datastore with given attributes |
|
DataStore(java.lang.String fileName,
int userSignature,
boolean open,
boolean readOnly,
int order)
Constructor for DataStore : create datastore with given attributes |
Method Summary | |
---|---|
long |
add(byte[] data,
int length)
Add new record : returns assigned record ID |
long |
addAndRemove(long delkey,
byte[] data,
int length)
Add a new record AND delete an existing record : allows faster update of logging-style DataStore file |
long[] |
addAndRemoveMultiple(int num,
long[] delkeys,
byte[][] data,
int[] length)
Add multiple new records AND delete multiple existing record : allows faster update of logging-style DataStore file |
long[] |
addAndRemoveMultiple2(int num,
long[] delkeys,
byte[][] data,
int[] length)
Add multiple new records AND delete multiple existing record : allows faster update of logging-style DataStore file - if delete records don't exist, continue without an error. |
void |
addDataStoreListener(DataStoreListener listen)
Register DataStore listener for this DataStore instance |
static void |
addGlobalDataStoreListener(DataStoreListener listen)
Register DataStore listener for all DataStore instances |
long[] |
addMultiple(int num,
byte[][] data,
int[] length)
Add multiple new records : returns assigned record IDs |
void |
addUpdate(long key,
byte[] data,
int length)
Add new record, or update existing record, using given key |
void |
addUpdateMultiple(int num,
long[] keys,
byte[][] data,
int[] length)
Add new records, or update existing records, using given keys |
void |
close()
Closed datastore file |
void |
copyWholeDataStore(java.io.File new_file)
Safely copy whole contents of DataStore into a new file provided by the caller: allows thread-safe backup or replication of whole datastore. |
void |
delete()
Delete whole datastore and contents |
void |
enumerate(DataStoreEnumeration enumerator)
Fill in enumerator for all elements |
boolean |
exists(long key)
Test to see if record with given key exists |
java.lang.String |
getFileName()
Get DataStore file name |
int |
getIdentifier()
Get DataStore identifier |
LongValueSet |
getKeySet()
Get all of the record keys in a LongValueSet |
protected LongSortSet |
getRecordIDs()
|
long |
highestKey()
Get next key number |
boolean |
isNew()
Is newly created DataStore |
int |
length(long key)
Get length of given record |
long |
nextKey()
Get next key number |
static void |
notifyDataStoreFileDeleted(java.io.File file)
Notify global listeners of deleted DataStore file. |
int |
numRecords()
|
void |
open()
Open DataStore |
byte[][] |
read(long[] keys)
Read data for a set of keys, and return as a set of data arrays |
void |
read(long key,
byte[] data,
int length)
Read data from given key into buffer |
byte[] |
readWholeDataStore(long max_size)
Safely read whole contents of DataStore into a buffer for return to caller: allows thread-safe backup or replication of whole datastore. |
void |
remove(long key)
Remove record with given key |
void |
remove(long[] keys)
Remove set of records |
void |
removeAll()
Remove all data records from data store |
void |
removeDataStoreListener(DataStoreListener listen)
Deregister DataStore listener for this DataStore instance |
void |
removeGlobalDataStoreListener(DataStoreListener listen)
Deregister DataStore listener for all DataStore instances |
protected int |
setInitSize()
|
void |
setWriteFlush(boolean enabled)
Enable/disable per write disk flushing |
void |
update(long key,
byte[] data,
int length)
Update existing record |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DataStore(java.lang.String fileName) throws DataStoreException
fileName
- - filenamepublic DataStore(java.lang.String fileName, boolean open) throws DataStoreException
fileName
- - filenameopen
- - open initiallypublic DataStore(java.lang.String fileName, int userSignature, boolean open, boolean readOnly) throws DataStoreException
fileName
- - filenameuserSignature
- - user signatureopen
- - open initiallyreadOnly
- - read-only accesspublic DataStore(java.lang.String fileName, int userSignature, boolean open, boolean readOnly, int order) throws DataStoreException
fileName
- - filenameuserSignature
- - user signatureopen
- - open initiallyreadOnly
- - read-only accessorder
- - records per index recordMethod Detail |
public void open() throws DataStoreException
DataStoreException
public final java.lang.String getFileName()
public final int getIdentifier()
public boolean isNew()
public boolean exists(long key) throws DataStoreException
key
- - key to be checked
DataStoreException
public long add(byte[] data, int length) throws DataStoreException
data
- - data to be writtenlength
- - length of data to be written
DataStoreException
public long[] addMultiple(int num, byte[][] data, int[] length) throws DataStoreException
data
- - array of data records to be writtenlength
- - array of lengths of data records to be written
DataStoreException
public long addAndRemove(long delkey, byte[] data, int length) throws DataStoreException
delkey
- - key to be deleteddata
- - data for new record to be written
DataStoreException
public long[] addAndRemoveMultiple(int num, long[] delkeys, byte[][] data, int[] length) throws DataStoreException
num
- - number of keys to delete and number of records to adddelkeys
- - array of key to be deleteddata
- - array of data buffers for new records to be written
DataStoreException
public long[] addAndRemoveMultiple2(int num, long[] delkeys, byte[][] data, int[] length) throws DataStoreException
num
- - number of keys to delete and number of records to adddelkeys
- - array of key to be deleteddata
- - array of data buffers for new records to be written
DataStoreException
public void addUpdate(long key, byte[] data, int length) throws DataStoreException
key
- - record keydata
- - data to be storedlength
- - length of data
DataStoreException
public void addUpdateMultiple(int num, long[] keys, byte[][] data, int[] length) throws DataStoreException
num
- - number of records to add or updatekeys
- - array of record keysdata
- - array of data to be storedlength
- - array of lengths of data
DataStoreException
public int length(long key) throws DataStoreException
key
- - record key
DataStoreException
public void read(long key, byte[] data, int length) throws DataStoreException
key
- - record keydata
- - data buffer to read data intolength
- - length of data requested
DataStoreException
public byte[][] read(long[] keys) throws DataStoreException
keys
- - key array
DataStoreException
public void update(long key, byte[] data, int length) throws DataStoreException
key
- - record keydata
- - record datalength
- - length of record data
DataStoreException
public void remove(long key) throws DataStoreException
key
- - record key
DataStoreException
public void remove(long[] keys) throws DataStoreException
keys
- - list of keys
DataStoreException
public void removeAll() throws DataStoreException
DataStoreException
public LongValueSet getKeySet()
public void enumerate(DataStoreEnumeration enumerator) throws DataStoreException
enumerator
- - enumerator to callback to with each found element
DataStoreException
public void close() throws DataStoreException
DataStoreException
public void delete() throws DataStoreException
DataStoreException
public void setWriteFlush(boolean enabled) throws DataStoreIOException
DataStoreIOException
public long nextKey()
public long highestKey()
protected int setInitSize()
public void addDataStoreListener(DataStoreListener listen)
listen
- - listenerpublic void removeDataStoreListener(DataStoreListener listen)
listen
- - listenerpublic static void addGlobalDataStoreListener(DataStoreListener listen)
listen
- - listenerpublic void removeGlobalDataStoreListener(DataStoreListener listen)
listen
- - listenerpublic static void notifyDataStoreFileDeleted(java.io.File file)
file
- - file deletedpublic byte[] readWholeDataStore(long max_size) throws DataStoreException
max_size
- - maximum size to copy to buffer
DataStoreException
- if error reading filepublic void copyWholeDataStore(java.io.File new_file) throws DataStoreException
new_file
- - new file for contents
DataStoreException
- if error reading or writing filepublic int numRecords()
protected LongSortSet getRecordIDs()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |