casacore
Loading...
Searching...
No Matches
StorageOption.h
Go to the documentation of this file.
1// # StorageOption.h: Options defining how table files are organized
2// # Copyright (C) 2014
3// # Associated Universities, Inc. Washington DC, USA.
4// #
5// # This library is free software; you can redistribute it and/or modify it
6// # under the terms of the GNU Library General Public License as published by
7// # the Free Software Foundation; either version 2 of the License, or (at your
8// # option) any later version.
9// #
10// # This library is distributed in the hope that it will be useful, but WITHOUT
11// # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12// # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13// # License for more details.
14// #
15// # You should have receied a copy of the GNU Library General Public License
16// # along with this library; if not, write to the Free Software Foundation,
17// # Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18// #
19// # Correspondence concerning AIPS++ should be addressed as follows:
20// # Internet email: casa-feedback@nrao.edu.
21// # Postal address: AIPS++ Project Office
22// # National Radio Astronomy Observatory
23// # 520 Edgemont Road
24// # Charlottesville, VA 22903-2475 USA
25
26#ifndef TABLES_STORAGEOPTION_H
27#define TABLES_STORAGEOPTION_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31
32namespace casacore { // # NAMESPACE CASACORE - BEGIN
33
34// <summary>
35// Options defining how table files are organized
36// </summary>
37
38// <use visibility=export>
39
40// <reviewed reviewer="TPPR" date="08.11.94" tests="tTable.cc">
41// </reviewed>
42
43// <synopsis>
44// This class can be used to define how the files of a table are organized.
45// There are two ways:
46// <ol>
47// <li> The old way where each storage manager has its own file(s).
48// <li> Using MultiFile that storage managers can use to combine about all
49// table files in a single file. This mode is particularly useful
50// for new file systems (like Lustre) requiring large block sizes.
51// <br>The block size to be used in a MultiFile can be defined in
52// this class. Default is 4 MByte.
53// <li> Using MultiHDF5 which behaves similar to MultiFile but uses an
54// HDF5 file instead of a regular file. Note that it requires that
55// support for HDF5 has been used in the build system.
56// </ol>
57// It is possible to specify the storage type and block size using aipsrc.
58// The aipsrc variables are:
59// <ul>
60// <li> <src>table.storage.option</src>. The (case-insensitive) value can be
61// 'multifile' or 'multihdf5'.
62// Another value means the old way (separate files).
63// <li> <src>table.storage.blocksize</src> gives the default blocksize to be
64// used for the multifile and multihdf5 option.
65// <li> <src>table.storage.odirect</src> can be true or false. It tells if the
66// O_DIRECT option has to be used to let the kernel bypass its filecache
67// for more predictable I/O behaviour. It's only used for MultiFile and
68// only if the OS supports O_DIRECT.
69// </ul>
70// </synopsis>
71
73 public:
74 // Define the possible options how table files are organized.
75 enum Option {
76 // Let storage managers use a combined MultiFile.
78 // Let storage managers use a combined MultiHDF5.
80 // Let storage managers use separate files.
82 // Use default (currently SepFile).
84 // Use as defined in the aipsrc file.
86 };
87
88 // Create an option object.
89 // The parameter values are described in the synopsis.
90 // The blocksize has to be given in bytes.
91 // A size value -2 means reading that size from the aipsrc file.
92 // A size value -1 means use the default of 4*1024*1024.
93 // <br>useODirect<0 means reading the option from the aipsrc file.
94 // It is only set if the OS supports O_DIRECT.
96
97 // Fill the option in case Aipsrc or Default was given.
98 // It is done as explained in the synopsis.
99 void fillOption();
100
101 // Get the option.
102 Option option() const { return itsOption; }
103
104 // Set the option.
106
107 // Get the block size (in bytes).
108 uInt blockSize() const { return itsBlockSize; }
109
110 // Set the block size (in bytes).
112
113 // Get the O_DIRECT option.
114 Bool useODirect() const { return itsUseODirect; }
115
116 // Set the O_DIRECT option.
117 // It is only set if the OS supports O_DIRECT.
119
120 private:
125};
126
127} // namespace casacore
128
129#endif
StorageOption(Option option=Aipsrc, Int blockSize=-2, Int useODirect=-3)
Create an option object.
void fillOption()
Fill the option in case Aipsrc or Default was given.
void setOption(Option option)
Set the option.
Bool useODirect() const
Get the O_DIRECT option.
Option
Define the possible options how table files are organized.
@ MultiFile
Let storage managers use a combined MultiFile.
@ SepFile
Let storage managers use separate files.
@ MultiHDF5
Let storage managers use a combined MultiHDF5.
@ Aipsrc
Use as defined in the aipsrc file.
@ Default
Use default (currently SepFile).
uInt blockSize() const
Get the block size (in bytes).
void setBlockSize(Int blockSize)
Set the block size (in bytes).
void setUseODirect(Bool useODirect)
Set the O_DIRECT option.
Option option() const
Get the option.
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40