casacore
|
#include <ISMBase.h>
Public Member Functions | |
ISMBase (uInt bucketSize=0, Bool checkBucketSize=True, uInt cacheSize=1) | |
Create an incremental storage manager without a name. More... | |
ISMBase (const String &dataManagerName, uInt bucketSize, Bool checkBucketSize, uInt cacheSize) | |
Create an incremental storage manager with the given name. More... | |
ISMBase (const String &aDataManName, const Record &spec) | |
Create an incremental storage manager with the given name. More... | |
~ISMBase () | |
virtual DataManager * | clone () const |
Clone this object. More... | |
virtual String | dataManagerType () const |
Get the type name of the data manager (i.e. More... | |
virtual String | dataManagerName () const |
Get the name given to the storage manager (in the constructor). More... | |
virtual Record | dataManagerSpec () const |
Record a record containing data manager specifications. More... | |
virtual Record | getProperties () const |
Get data manager properties that can be modified. More... | |
virtual void | setProperties (const Record &spec) |
Modify data manager properties. More... | |
uInt | version () const |
Get the version of the class. More... | |
void | setCacheSize (uInt cacheSize, Bool canExceedNrBuckets) |
Set the cache size (in buckets). More... | |
uInt | cacheSize () const |
Get the current cache size (in buckets). More... | |
void | clearCache () |
Clear the cache used by this storage manager. More... | |
virtual void | showCacheStatistics (ostream &os) const |
Show the statistics of all caches used. More... | |
void | showIndexStatistics (ostream &os) |
Show the index statistics. More... | |
void | showBucketLayout (ostream &os) |
Show the layout of the buckets. More... | |
uInt | bucketSize () const |
Get the bucket size (in bytes). More... | |
uInt | uIntSize () const |
Get the size of a uInt in external format (can be canonical or local). More... | |
uInt | rownrSize () const |
Get the size of a rownr in external format (can be canonical or local). More... | |
ISMBucket * | getBucket (rownr_t rownr, rownr_t &bucketStartRow, rownr_t &bucketNrrow) |
Get the bucket containing the given row. More... | |
ISMBucket * | nextBucket (uInt &cursor, rownr_t &bucketStartRow, rownr_t &bucketNrrow) |
Get the next bucket. More... | |
char * | tempBuffer () const |
Get access to the temporary buffer. More... | |
uInt | uniqueNr () |
Get a unique column number for the column (it is only unique for this storage manager). More... | |
rownr_t | nrow () const |
Get the number of rows in this storage manager. More... | |
virtual Bool | canAddRow () const |
Can the storage manager add rows? (yes) More... | |
virtual Bool | canRemoveRow () const |
Can the storage manager delete rows? (yes) More... | |
virtual Bool | canAddColumn () const |
Can the storage manager add columns? (not yet) More... | |
virtual Bool | canRemoveColumn () const |
Can the storage manager delete columns? (not yet) More... | |
ISMColumn & | getColumn (uInt colnr) |
Get access to the given column. More... | |
void | addBucket (rownr_t rownr, ISMBucket *bucket) |
Add a bucket to the storage manager (i.e. More... | |
void | setBucketDirty () |
Make the current bucket in the cache dirty (i.e. More... | |
StManArrayFile * | openArrayFile (ByteIO::OpenOption opt) |
Open (if needed) the file for indirect arrays with the given mode. More... | |
Bool | checkBucketLayout (uInt &offendingCursor, rownr_t &offendingBucketStartRow, uInt &offendingBucketNrow, uInt &offendingBucketNr, uInt &offendingCol, uInt &ffendingIndex, rownr_t &offendingRow, rownr_t &offendingPrevRow) |
Check that there are no repeated rowIds in the buckets comprising this ISM. More... | |
Public Member Functions inherited from casacore::DataManager | |
DataManager () | |
Default constructor. More... | |
virtual | ~DataManager () |
void | dataManagerInfo (Record &info) const |
Add SEQNR and SPEC (the DataManagerSpec subrecord) to the info. More... | |
virtual Bool | isStorageManager () const |
Is the data manager a storage manager? The default is yes. More... | |
virtual Bool | canReallocateColumns () const |
Tell if the data manager wants to reallocate the data manager column objects. More... | |
virtual DataManagerColumn * | reallocateColumn (DataManagerColumn *column) |
Reallocate the column object if it is part of this data manager. More... | |
uInt | sequenceNr () const |
Get the (unique) sequence nr of this data manager. More... | |
uInt | ncolumn () const |
Get the nr of columns in this data manager (can be zero). More... | |
Bool | asBigEndian () const |
Have the data to be stored in big or little endian canonical format? More... | |
const TSMOption & | tsmOption () const |
Get the TSM option. More... | |
MultiFileBase * | multiFile () |
Get the MultiFile pointer (can be 0). More... | |
String | keywordName (const String &keyword) const |
Compose a keyword name from the given keyword appended with the sequence number (e.g. More... | |
String | fileName () const |
Compose a unique filename from the table name and sequence number. More... | |
ByteIO::OpenOption | fileOption () const |
Get the AipsIO option of the underlying file. More... | |
virtual Bool | isRegular () const |
Is this a regular storage manager? It is regular if it allows addition of rows and writing data in them. More... | |
Table & | table () const |
Get the table this object is associated with. More... | |
virtual Bool | canRenameColumn () const |
Does the data manager allow to rename columns? (default yes) More... | |
virtual void | setMaximumCacheSize (uInt nMiB) |
Set the maximum cache size (in bytes) to be used by a storage manager. More... | |
virtual void | showCacheStatistics (std::ostream &) const |
Show the data manager's IO statistics. More... | |
DataManagerColumn * | createScalarColumn (const String &columnName, int dataType, const String &dataTypeId) |
Create a column in the data manager on behalf of a table column. More... | |
DataManagerColumn * | createDirArrColumn (const String &columnName, int dataType, const String &dataTypeId) |
Create a direct array column. More... | |
DataManagerColumn * | createIndArrColumn (const String &columnName, int dataType, const String &dataTypeId) |
Create an indirect array column. More... | |
DataManager * | getClone () const |
Has the object already been cloned? More... | |
void | setClone (DataManager *clone) const |
Set the pointer to the clone. More... | |
Static Public Member Functions | |
static DataManager * | makeObject (const String &dataManagerType, const Record &spec) |
Make the object from the type name string. More... | |
Static Public Member Functions inherited from casacore::DataManager | |
static void | registerCtor (const String &type, DataManagerCtor func) |
Register a mapping of a data manager type to its static construction function. More... | |
static DataManagerCtor | getCtor (const String &dataManagerType) |
Get the "constructor" of a data manager (thread-safe). More... | |
static Bool | isRegistered (const String &dataManagerType) |
Test if a data manager is registered (thread-safe). More... | |
static DataManager * | unknownDataManager (const String &dataManagerType, const Record &spec) |
Serve as default function for theirRegisterMap, which catches all unknown data manager types. More... | |
Private Member Functions | |
ISMBase (const ISMBase &that) | |
Copy constructor (only meant for clone function). More... | |
ISMBase & | operator= (const ISMBase &that) |
Assignment cannot be used. More... | |
void | recreate () |
(Re)create the index, file, and cache object. More... | |
virtual Bool | hasMultiFileSupport () const |
The data manager supports use of MultiFile. More... | |
virtual Bool | flush (AipsIO &, Bool fsync) |
Flush and optionally fsync the data. More... | |
virtual void | create64 (rownr_t nrrow) |
Let the storage manager create files as needed for a new table. More... | |
virtual rownr_t | open64 (rownr_t nrrow, AipsIO &) |
Open the storage manager file for an existing table, read in the data, and let the ISMColumn objects read their data. More... | |
virtual rownr_t | resync64 (rownr_t nrrow) |
Resync the storage manager with the new file contents. More... | |
virtual void | reopenRW () |
Reopen the storage manager files for read/write. More... | |
virtual void | deleteManager () |
The data manager will be deleted (because all its columns are requested to be deleted). More... | |
void | init () |
Let the storage manager initialize itself. More... | |
virtual void | addRow64 (rownr_t nrrow) |
Add rows to the storage manager. More... | |
virtual void | removeRow64 (rownr_t rownr) |
Delete a row from all columns. More... | |
virtual void | addColumn (DataManagerColumn *) |
Do the final addition of a column. More... | |
virtual void | removeColumn (DataManagerColumn *) |
Remove a column from the data file and the colSet_p . More... | |
virtual DataManagerColumn * | makeScalarColumn (const String &name, int dataType, const String &dataTypeID) |
Create a column in the storage manager on behalf of a table column. More... | |
virtual DataManagerColumn * | makeDirArrColumn (const String &name, int dataType, const String &dataTypeID) |
Create a direct array column. More... | |
virtual DataManagerColumn * | makeIndArrColumn (const String &name, int dataType, const String &dataTypeID) |
Create an indirect array column. More... | |
BucketCache & | getCache () |
Get the cache object. More... | |
ISMIndex & | getIndex () |
Get the index object. More... | |
void | makeCache () |
Construct the cache object (if not constructed yet). More... | |
void | makeIndex () |
Construct the index object (if not constructed yet) and read it. More... | |
void | readIndex () |
Read the index (at the end of the file). More... | |
void | writeIndex () |
Write the index (at the end of the file). More... | |
Private Attributes | |
String | dataManName_p |
Name of data manager. More... | |
uInt | version_p |
The version of the class. More... | |
StManArrayFile * | iosfile_p |
The file containing the indirect arrays. More... | |
uInt | uniqnr_p |
Unique nr for column in this storage manager. More... | |
rownr_t | nrrow_p |
The number of rows in the columns. More... | |
PtrBlock< ISMColumn * > | colSet_p |
The assembly of all columns. More... | |
BucketCache * | cache_p |
The cache with the ISM buckets. More... | |
BucketFile * | file_p |
The file containing all data. More... | |
ISMIndex * | index_p |
The ISM bucket index. More... | |
uInt | persCacheSize_p |
The persistent cache size. More... | |
uInt | cacheSize_p |
The actual cache size. More... | |
uInt | nbucketInit_p |
The initial number of buckets in the cache. More... | |
uInt | nFreeBucket_p |
The nr of free buckets. More... | |
Int | firstFree_p |
The first free bucket. More... | |
uInt | bucketSize_p |
The bucket size. More... | |
Bool | checkBucketSize_p |
Check a positive bucketsize? More... | |
Bool | dataChanged_p |
Has the data changed since the last flush? More... | |
uInt | uIntSize_p |
The size of a uInt in external format (local or canonical). More... | |
uInt | rownrSize_p |
The size of a rownr in external format (local or canonical). More... | |
char * | tempBuffer_p |
A temporary read/write buffer (also for other classes). More... | |
Additional Inherited Members | |
Static Public Attributes inherited from casacore::DataManager | |
static rownr_t | MAXROWNR32 |
Define the highest row number that can be represented as signed 32-bit. More... | |
Protected Member Functions inherited from casacore::DataManager | |
void | decrementNcolumn () |
Decrement number of columns (in case a column is deleted). More... | |
void | setEndian (Bool bigEndian) |
Tell the data manager if big or little endian format is needed. More... | |
void | setTsmOption (const TSMOption &tsmOption) |
Tell the data manager which TSM option to use. More... | |
void | setMultiFile (MultiFileBase *mfile) |
Tell the data manager that MultiFile can be used. More... | |
void | throwDataTypeOther (const String &columnName, int dataType) const |
Throw an exception in case data type is TpOther, because the storage managers (and maybe other data managers) do not support such columns. More... | |
Base class of the Incremental Storage Manager
Internal
ISMBase is the base class of the Incremental Storage Manager.
The behaviour of this class is described in IncrementalStMan.
The public interface of ISMBase is quite large, because the other internal ISM classes need these functions. To have a class with a minimal interface for the normal user, class IncrementalStMan
is derived from it.
IncrementalStMan needs an isA- instead of hasA-relation to be able to bind columns to it in class SetupNewTable.
|
explicit |
Create an incremental storage manager without a name.
The bucket size has to be given in bytes and the cache size in buckets. The bucket size is checked or calculated (if 0) as described in IncrementalStMan.h.
casacore::ISMBase::ISMBase | ( | const String & | dataManagerName, |
uInt | bucketSize, | ||
Bool | checkBucketSize, | ||
uInt | cacheSize | ||
) |
Create an incremental storage manager with the given name.
The bucket size has to be given in bytes and the cache size in buckets. The bucket size is checked or calculated (if 0) as described in IncrementalStMan.h.
Create an incremental storage manager with the given name.
The specifications are in the record (as created by dataManagerSpec).
casacore::ISMBase::~ISMBase | ( | ) |
|
private |
Copy constructor (only meant for clone function).
Add a bucket to the storage manager (i.e.
to the cache). The pointer is taken over.
|
privatevirtual |
Do the final addition of a column.
The DataManagerColumn
object has already been created (by the makeXXColumn
function) and added to colSet_p
. However, it still has to be added to the data files, which is done by this function. It uses the pointer to find the correct column in the colSet_p
.
Reimplemented from casacore::DataManager.
|
privatevirtual |
Add rows to the storage manager.
Per column it extends the interval for which the last value written is valid.
Reimplemented from casacore::DataManager.
|
inline |
|
inline |
Get the current cache size (in buckets).
Definition at line 392 of file ISMBase.h.
References cacheSize_p.
|
virtual |
Can the storage manager add columns? (not yet)
Reimplemented from casacore::DataManager.
|
virtual |
Can the storage manager add rows? (yes)
Reimplemented from casacore::DataManager.
|
virtual |
Can the storage manager delete columns? (not yet)
Reimplemented from casacore::DataManager.
|
virtual |
Can the storage manager delete rows? (yes)
Reimplemented from casacore::DataManager.
Bool casacore::ISMBase::checkBucketLayout | ( | uInt & | offendingCursor, |
rownr_t & | offendingBucketStartRow, | ||
uInt & | offendingBucketNrow, | ||
uInt & | offendingBucketNr, | ||
uInt & | offendingCol, | ||
uInt & | ffendingIndex, | ||
rownr_t & | offendingRow, | ||
rownr_t & | offendingPrevRow | ||
) |
Check that there are no repeated rowIds in the buckets comprising this ISM.
void casacore::ISMBase::clearCache | ( | ) |
Clear the cache used by this storage manager.
It will flush the cache as needed and remove all buckets from it.
|
virtual |
Clone this object.
It does not clone ISMColumn objects possibly used. The caller has to delete the newly created object.
Implements casacore::DataManager.
|
privatevirtual |
Let the storage manager create files as needed for a new table.
This allows a column with an indirect array to create its file.
Reimplemented from casacore::DataManager.
|
virtual |
Get the name given to the storage manager (in the constructor).
Reimplemented from casacore::DataManager.
|
virtual |
Record a record containing data manager specifications.
Reimplemented from casacore::DataManager.
|
virtual |
|
privatevirtual |
The data manager will be deleted (because all its columns are requested to be deleted).
So clean up the things needed (e.g. delete files).
Implements casacore::DataManager.
Flush and optionally fsync the data.
It returns a True status if it had to flush (i.e. if data have changed).
Implements casacore::DataManager.
ISMBucket* casacore::ISMBase::getBucket | ( | rownr_t | rownr, |
rownr_t & | bucketStartRow, | ||
rownr_t & | bucketNrrow | ||
) |
Get the bucket containing the given row.
Also return the first and last row of that bucket. The bucket object is created and deleted by the caching mechanism.
|
inlineprivate |
Get the cache object.
This will construct the cache object if not present yet. The cache object will be deleted by the destructor.
Definition at line 427 of file ISMBase.h.
References cache_p, and makeCache().
|
inlineprivate |
Get the index object.
This will construct the index object if not present yet. The index object will be deleted by the destructor.
Definition at line 435 of file ISMBase.h.
References index_p, and makeIndex().
|
virtual |
Get data manager properties that can be modified.
It is only ActualCacheSize (the actual cache size in buckets). It is a subset of the data manager specification.
Reimplemented from casacore::DataManager.
|
privatevirtual |
The data manager supports use of MultiFile.
Reimplemented from casacore::DataManager.
|
private |
Let the storage manager initialize itself.
It is used by create and open.
|
private |
Construct the cache object (if not constructed yet).
Referenced by getCache().
|
privatevirtual |
Create a direct array column.
Implements casacore::DataManager.
|
privatevirtual |
Create an indirect array column.
Implements casacore::DataManager.
|
private |
Construct the index object (if not constructed yet) and read it.
Referenced by getIndex().
|
static |
Make the object from the type name string.
This function gets registered in the DataManager "constructor" map. The caller has to delete the object.
|
privatevirtual |
Create a column in the storage manager on behalf of a table column.
The caller has to delete the newly created object.
Create a scalar column.
Implements casacore::DataManager.
ISMBucket* casacore::ISMBase::nextBucket | ( | uInt & | cursor, |
rownr_t & | bucketStartRow, | ||
rownr_t & | bucketNrrow | ||
) |
Get the next bucket.
cursor=0 indicates the start of the iteration. The first bucket returned is the bucket containing the rownr given in bucketStartRow. After each iteration BucketStartRow and bucketNrrow are set. A 0 is returned when no more buckets. The bucket object is created and deleted by the caching mechanism.
|
inline |
Open the storage manager file for an existing table, read in the data, and let the ISMColumn objects read their data.
Reimplemented from casacore::DataManager.
StManArrayFile* casacore::ISMBase::openArrayFile | ( | ByteIO::OpenOption | opt | ) |
Open (if needed) the file for indirect arrays with the given mode.
Return a pointer to the object.
|
private |
Read the index (at the end of the file).
|
private |
(Re)create the index, file, and cache object.
|
privatevirtual |
Remove a column from the data file and the colSet_p
.
The DataManagerColumn
object gets deleted..
Reimplemented from casacore::DataManager.
|
privatevirtual |
Delete a row from all columns.
Reimplemented from casacore::DataManager.
|
privatevirtual |
Reopen the storage manager files for read/write.
Reimplemented from casacore::DataManager.
Resync the storage manager with the new file contents.
This is done by clearing the cache.
Reimplemented from casacore::DataManager.
|
inline |
Get the size of a rownr in external format (can be canonical or local).
Definition at line 417 of file ISMBase.h.
References rownrSize_p.
void casacore::ISMBase::setBucketDirty | ( | ) |
Make the current bucket in the cache dirty (i.e.
something has been changed in it and it needs to be written when removed from the cache). (used by ISMColumn::putValue).
Set the cache size (in buckets).
If canExceedNrBuckets=True
, the given cache size can be larger than the nr of buckets in the file. In this way the cache can be made large enough for a future file extnsion. Otherwise, it is limited to the actual number of buckets. This is useful if one wants the entire file to be cached.
|
virtual |
Modify data manager properties.
Only MaxCacheSize can be used. It is similar to function setCacheSize with canExceedNrBuckets=False
.
Reimplemented from casacore::DataManager.
void casacore::ISMBase::showBucketLayout | ( | ostream & | os | ) |
Show the layout of the buckets.
|
virtual |
Show the statistics of all caches used.
void casacore::ISMBase::showIndexStatistics | ( | ostream & | os | ) |
Show the index statistics.
|
inline |
Get access to the temporary buffer.
Definition at line 422 of file ISMBase.h.
References tempBuffer_p.
|
inline |
Get the size of a uInt in external format (can be canonical or local).
Definition at line 412 of file ISMBase.h.
References uIntSize_p.
|
inline |
|
inline |
|
private |
Write the index (at the end of the file).
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
The size of a rownr in external format (local or canonical).
Definition at line 381 of file ISMBase.h.
Referenced by rownrSize().
|
private |
A temporary read/write buffer (also for other classes).
Definition at line 383 of file ISMBase.h.
Referenced by tempBuffer().
|
private |
The size of a uInt in external format (local or canonical).
Definition at line 379 of file ISMBase.h.
Referenced by uIntSize().
|
private |
Unique nr for column in this storage manager.
Definition at line 351 of file ISMBase.h.
Referenced by uniqueNr().
|
private |