NAME
Linux::Info::DiskStats::Options - Configuration for Linux::Info::DiskStats instances.
SYNOPSIS
$opts = Linux::Info::DiskStats::Options->new({
backwards_compatible => 1,
source_file => '/tmp/foobar.txt',
init_file => '/tmp/diskstats.yml',
global_block_size => 4096,
current_kernel => '2.6.18-0-generic',
})
DESCRIPTION
Configuration for Linux::Info::DiskStats can get so complex that is worth creating a class to describe and validate it.
The good news is that a instance of Linux::Info::DiskStats::Options
doesn't need to be that complex in every situation. But you will be glad to get validations in place anyway.
METHODS
new
The optional keys:
backwards_compatible
: if true (1), the returned statistics will be those provided by backwards compatibility. Also, it defines that block size information is required.If false (0), the new set of fields will be available.
Defaults to true.
source_file
: if provided, that will be the source file were the statistics will be read from. Otherwise, the default location (based on Linux kernel version) will be used instead. It is basically used to enable unit testing.init_file
: if set, you may to store/load the initial statistics to/from a file:my $lxs = Linux::Info::DiskStats->new({init_file => '/tmp/diskstats.yml'});
If you set
init_file
it's not necessary to callsleep
beforeget
.global_block_size
: with an integer as the value, all attached disks will have calculated statistics based on this value. You may use this if all the disks are using the same file system type.It is checked only if
backwards_compatible
is true.block_sizes
: if there are different file systems mounted, you will need to resort to a more complex configuration setting:my $opts_ref = { block_sizes => { deviceA => 512, deviceB => 4096, } };
It is checked only if
backwards_compatible
is true.
Regarding block sizes, you must choose one key or the other if backwards_compatible
is true. If both are absent, instances will die
during creation by invoking new
.
get_init_file
Getter for the init_file
attribute.
It will return undef
if the property wasn't defined.
get_source_file
Getter for the source_file
attribute.
It will return undef
if the property wasn't defined.
get_backwards_compatible
Getter for the backwards_compatible
attribute.
It will return undef
if the property wasn't defined.
get_block_sizes
Getter for the block_sizes
attribute.
It will return undef
if the property wasn't defined.
get_global_block_size
Getter for the global_block_size
attribute.
It will return undef
if the property wasn't defined.
get_current_kernel
Getter for the current_kernel
attribute.
It will return undef
if the property wasn't defined.
SEE ALSO
AUTHOR
Alceu Rodrigues de Freitas Junior, <glasswalk3r@yahoo.com.br>
COPYRIGHT AND LICENSE
This software is copyright (c) 2024 of Alceu Rodrigues de Freitas Junior, <glasswalk3r@yahoo.com.br>
This file is part of Linux Info project.
Linux-Info is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Linux-Info is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Linux Info. If not, see <http://www.gnu.org/licenses/>.