NAME
File::FStore::Adder - Module for interacting with file stores
VERSION
version v0.02
SYNOPSIS
use File::FStore;
my File::FStore $store = File::FStore->new(path => '...');
my File::FStore::Adder $adder = $store->new_adder;
$adder->move_in($filename);
$adder->set(...);
my File::FStore::File $file = $adder->insert;
This package implements an Adder, a helper object that can be used to add files to the store.
METHODS
link_in
$adder->link_in($filename);
Moves the given file in by means of adding a new hardlink. This will not destroy the original hardlink.
This however requires filesystem support for multiple hardlinks, as well as the source file being on the same filesystem as the store.
Also after "insert" has been called no changes to the file (using any of it's names) are allowed anymore.
This method die
s if there is any problem.
See also: "move_in".
move_in
$adder->move_in($filename);
Moves the given file in by means of renaming the file. This will destroy the original hardlink.
This will require the source file being on the same filesystem as the store.
Once this call was successful the file is no longer available under the old name.
If the file is not added to the store the file is unlinked.
This method die
s if there is any problem.
See also: "link_in".
set
$file->set($domain => $key => $value);
# or:
$file->set($domain => {$key => $value});
# or:
$file->set({$domain => {$key => $value}});
This sets a value on the file to be added alike "set" in File::FStore::File. This method works the same way as said method including safety checks.
done
$adder->done;
Marks the adder as done with all changes, but not yet inserted. This method die
s on error or on state missmatch.
Note: You normally don't need to call this method manually.
Note: All calls to "set" must be done before calling this method. Also all changes to the file must be done before. After calling this method the file is considered read-only.
Note: Calling this early can cause errors to be hidden or placed out of context.
reset
$adder->reset;
Resets the adder. Any data that has already been set is removed. Any temporary files are removed. Files moved in with "move_in" are unlinked.
insert
my File::FStore::File $file = $adder->insert;
Performs the actual insert of the file into the store.
This method die
s on error or returns the File::FStore::File object of the freshly inserted file.
Note: This adder is in undefined state after this call. The only save method to call after this is "reset".
contentise
my $ise = $file->contentise;
# or:
my $ise = $file->contentise(as => ...);
Returns the content based ISE (identifier) for the file. See "contentise" in File::FStore::File for details.
This value is only available once "done" is called.
store
my File::FStore $store = $file->store;
Returns the store this file belongs to.
db
my Data::TagDB $db = $file->db;
# or:
my Data::TagDB $db = $file->db(default => $def);
Proxy for "db" in File::FStore.
extractor
my Data::URIID $extractor = $file->extractor;
# or:
my Data::URIID $extractor = $file->extractor(default => $def);
Proxy for "extractor" in File::FStore.
fii
my File::Information $fii = $file->fii;
Proxy for "fii" in File::FStore.
AUTHOR
Löwenfelsen UG (haftungsbeschränkt) <support@loewenfelsen.net>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2025 by Löwenfelsen UG (haftungsbeschränkt) <support@loewenfelsen.net>.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)