- COPYRIGHT AND LICENSE
Stepford::Role::Step::FileGenerator::Atomic - A role for steps that generate a file atomically
This role consumes the Stepford::Role::Step::FileGenerator role. It allows only one file production, but makes sure it is written atomically - the file will not exist if the step aborts. The file will only be committed to its final destination when
run completes successfully.
Instead of manipulating the file production directly, you work with the file given by
$step->pre_commit_file. This role will make sure it gets committed after
This role provides the following methods:
This method adds a wrapper to the BUILD method which ensures that there is only one production.
This returns a temporary file in a temporary directory that you can manipulate inside
run. It will be removed if the step fails, or renamed to the final file production if the step succeeds.
When running steps in parallel, it is important to ensure that you do not call the
$step->pre_commit_file method outside of the
$step->run method. If you call this at object creation time, this can cause the tempdir containing the
pre_commit_file file to be created and destroyed before the run method ever gets a chance to run.
Bugs may be submitted through https://github.com/maxmind/Stepford/issues.
Dave Rolsky <firstname.lastname@example.org>
This software is copyright (c) 2014 - 2019 by MaxMind, Inc.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.