NAME
File::Information::Tagpool - generic module for extrating information from filesystems
VERSION
version v0.02
SYNOPSIS
use File::Information;
Note: This package inherits from File::Information::Base.
METHODS
lock
my File::Information::Lock $lock = $pool->lock;
Locks the pool and returns the lock.
Some operations require the pool to be in locked state. Specifically all write operations. When the pool is locked no other process or instance can access it.
The lock stays valid as long as a reference to $lock
is kept alive. See File::Information::Lock about locks. It is possible to acquire multiple lock objects from the same instance ($pool
). In that case the pool stays locked until all lock references are gone.
Note: Locking the pool may take time as we might wait on other locks. It may also fail (die
ing if it does) if no lock can be acquired.
Note: If you perform multiple write operations it will generally improve performance significantly to keep it locked. To do this acquire a lock before you start your operations and hold for as long as you keep working on the pool. However you should not lock the pool while idle to allow other processes to interact with it as well. How long is too long is hard to answer in a general manner.
See also: "locked"
locked
$pool->locked(sub {
# your code ...
});
This call run the passed coderef with an active lock. It is similar to:
{
my File::Information::Lock $lock = $pool->lock;
{
# your code ....
}
}
Note: It is safe to use this method even if you already hold a lock. This allows code calling this method to not need to take notice about the current state of locking.
See also: "lock"
load_sysfile_cache
my File::Information::Lock $lock ...;
$pool->load_sysfile_cache;
This method loads the pool's sysfile cache into memory. It will do nothing if the cache is already loaded. The sysfile cache is only valid as long as the pool is locked. It is automatically discarded on unlock.
This method will also seed the instance's sysfile cache (see File::Information). The instance's cache may survive pool unlock.
Note: This method is normally not needed to be called manually. However if you perform a lot of read operations on the pool (such as calling "for_link" in File::Information or "for_handle" in File::Information on a large number of different files) this can be beneficial. It also allows to seed the cache ahead of time to speed up lookups later on.
Note: This method caches information on all sysfiles in the pool in memory. This can be memory expensive. One should expect at least 1024 Byte of memory usage per file in the pool. For small pools this is of no concern. However for larger pools it must be considered. Also, as this seeds the instance's cache not all of it may be gone once the pool is unlocked. See File::Information for it's cache handling.
file_add
$pool->file_add(\@files [, %opts ]);
Adds the given files to the pool. On error this method die
s.
The pool is automatically locked if it is not yet locked. If you want to add multiple files you can pass them. If you want to call this method multiple times it might be more performant to acquire a lock before and hold it until you're done.
The following (all optional) options are supported:
skip_already
-
Files that are already in the pool are silently skipped.
skip_invalid
-
Silently skip files that are invalid for any reason.
AUTHOR
Löwenfelsen UG (haftungsbeschränkt) <support@loewenfelsen.net>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2024 by Löwenfelsen UG (haftungsbeschränkt) <support@loewenfelsen.net>.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)