casa
5.7.0-16
|
Use file mapping for buckets in a part of a file. More...
#include <BucketMapped.h>
Public Member Functions | |
BucketMapped (BucketFile *file, Int64 startOffset, uInt bucketSize, uInt nrOfBuckets) | |
Create the cache for (part of) a file. More... | |
~BucketMapped () | |
Unmap the file. More... | |
const char * | getBucket (uInt bucketNr) |
Get a readonly pointer to the given bucket in memory. More... | |
char * | getrwBucket (uInt bucketNr) |
Get a writable pointer to the given bucket in memory. More... | |
Public Member Functions inherited from casacore::BucketBase | |
BucketBase (BucketFile *file, Int64 startOffset, uInt bucketSize, uInt nrOfBuckets) | |
Create the bucket access for (part of) a file. More... | |
virtual | ~BucketBase () |
Detach the file. More... | |
Bool | flush () |
Flush the cached buckets. More... | |
virtual void | resync (uInt nrBucket) |
Resynchronize the object (after another process updated the file). More... | |
uInt | nBucket () const |
Get the current nr of buckets in the file. More... | |
void | extend (uInt nrBucket) |
Extend the file with the given number of buckets. More... | |
void | setWritten () |
Set that data has been written. More... | |
Private Member Functions | |
BucketMapped (const BucketMapped &) | |
Copy constructor is not possible. More... | |
BucketMapped & | operator= (const BucketMapped &) |
Assignment is not possible. More... | |
virtual void | doFlush () |
Flush the file. More... | |
virtual void | doResync () |
Do the actual resync-ing. More... | |
virtual void | doExtend (uInt nrBucket) |
Extend the file with the given number of buckets. More... | |
virtual void | initializeBuckets (uInt bucketNr) |
Initialize the bucket buffer. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from casacore::BucketBase | |
BucketBase (const BucketBase &) | |
Copy constructor is not possible. More... | |
BucketBase & | operator= (const BucketBase &) |
Assignment is not possible. More... | |
Protected Attributes inherited from casacore::BucketBase | |
BucketFile * | itsFile |
The file used. More... | |
Int64 | itsStartOffset |
The starting offsets of the buckets in the file. More... | |
uInt | itsBucketSize |
The bucket size. More... | |
uInt | itsCurNrOfBuckets |
The current nr of buckets in the file. More... | |
uInt | itsNewNrOfBuckets |
The new nr of buckets in the file (after extension). More... | |
Bool | itsHasWritten |
Have data been written? More... | |
Use file mapping for buckets in a part of a file.
Public interface
BucketMapped uses memory-mapped files for bucket access.
BucketMapped is similar to class BucketCache and is meant to be used by the storage managers of the Table System.
It gives access to buckets in a file by means of memory-mapped files. However, its functionality is a subset of BucketCache and is only meant to be used by the Tiled Storage Managers. If The Standard and Incremental Storage Manager also want to use it, functions like extend
needs to be added to this class. Also support for a free bucket list needs to be added.
Use of BucketCache is sub-optimal when having large buckets and more or less random IO. Memory-mapping behaves much better.
Definition at line 76 of file BucketMapped.h.
casacore::BucketMapped::BucketMapped | ( | BucketFile * | file, |
Int64 | startOffset, | ||
uInt | bucketSize, | ||
uInt | nrOfBuckets | ||
) |
Create the cache for (part of) a file.
The file part mapped into memory starts at startOffset. Its length is bucketSize*nrOfBuckets bytes. If the file is smaller, the remainder is indicated as an extension similarly to the behaviour of function extend.
casacore::BucketMapped::~BucketMapped | ( | ) |
Unmap the file.
|
private |
Copy constructor is not possible.
|
privatevirtual |
Extend the file with the given number of buckets.
Implements casacore::BucketBase.
|
privatevirtual |
Flush the file.
Implements casacore::BucketBase.
|
privatevirtual |
Do the actual resync-ing.
Implements casacore::BucketBase.
const char* casacore::BucketMapped::getBucket | ( | uInt | bucketNr | ) |
Get a readonly pointer to the given bucket in memory.
Referenced by getrwBucket().
|
inline |
Get a writable pointer to the given bucket in memory.
It sets the hasWritten flag.
Definition at line 95 of file BucketMapped.h.
References getBucket(), casacore::BucketBase::itsHasWritten, and casacore::True.
|
privatevirtual |
Initialize the bucket buffer.
The uninitialized buckets before this bucket are also initialized.
Implements casacore::BucketBase.
|
private |
Assignment is not possible.