[Re-implement] Upload with ".tmp" suffix and rename file name after upload #43
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a revise of #37
Some MA tools are polling if remote files with specific file name exists at SFTP server and will import it when file exists. In this case, MA tool doesn't know if Embulk output process is already completed or not.
With this feature, plugin will upload ".tmp" file first, and rename them to ".csv"(or something) after upload finishes.
I changed implementation to set temporary_filename and real_filename to Embulk TaskReport at SftpFileOutput.commit().
After all tasks completed, plugin will get each file name sets and rename remote files.
Of course, temporary file will be left in remote server "/path/to/file.txt.tmp".
However, this is help full for simple mechanical check.
I created another PR #44 since Apache Commons VFS2 is checking parent directory's permission with SSH when rename and it should cause permission failure #40 if command execution over SSH isn't permitted for SFTP account.