Provide an attribute class for file cleaner configuration.
More...
Namespaces |
namespace | balb |
Detailed Description
- Outline
-
-
- Purpose:
- Provide an attribute class for file cleaner configuration.
-
- Classes:
-
- See also:
- Component balb_filecleanerutil
-
- Description:
- This component provides a single, simply constrained (value-semantic) attribute class,
balb::FileCleanerConfiguration
, that contains a set of attributes (objects and parameters) of a file cleaner.
-
- Attributes:
Name Type Default Simple Constraints
-------------- ------------------ -------------- ------------------
filePattern bsl::string "" none
maxFileAge bsls::TimeInterval TimeInterval() none
minNumFiles int 0 [0 .. INT_MAX]
-
filePattern
: filesystem pattern used for file matching.
-
maxFileAge
: maximum file age (since last modification).
-
minNumFiles
: minumum number of (newest) files, matching the pattern, that must be kept by the file cleaner.
-
- Thread Safety:
balb::FileCleanerConfiguration
is const thread-safe, meaning that accessors may be invoked concurrently from different threads, but it is not safe to access or modify a balb::FileCleanerConfiguration
in one thread while another thread modifies the same object.
-
- Usage:
- This section illustrates intended use of this component.
-
- Example 1: Basic Usage:
- The following code illustrates how to create a configuration that can be later supplied to a file cleanup utility (see
balb_filecleanerutil
for an example of how to use the created configuration to perform file cleaning).
- First, we create a
balb::FileCleanerConfiguration
object having the default value: Next, we populate the attributes of our configuration object: Now, we verify the options are configured correctly: Finally, we print the configuration value to cout
and return: bsl::cout << config << bsl::endl;
This produces the following (multi-line) output: [
FilePattern = /var/log/myApp/log*
MaxFileAge = (86400, 0)
MinNumFiles = 4
]