Skip to content
Snippets Groups Projects
Commit 05f01b67 authored by Pavel Kácha's avatar Pavel Kácha
Browse files

Changed "temp" to "tmp", originated as mental typo (should not cause problems...

Changed "temp" to "tmp", originated as mental typo (should not cause problems as filer ensures directory creation itself)
parent 886ddc8c
No related branches found
No related tags found
No related merge requests found
...@@ -135,11 +135,11 @@ directories must obey simple protocols, which use atomic "rename" to avoid ...@@ -135,11 +135,11 @@ directories must obey simple protocols, which use atomic "rename" to avoid
locking issues. locking issues.
Also, your directory (and its structure) _must_ reside on the same Also, your directory (and its structure) _must_ reside on the same
filesystem to keep "rename" atomic. _Never_ try to mount some of the filesystem to keep "rename" atomic. _Never_ try to mount some of the
subdirectories ("temp", "incoming", "errors") from other filesystem. subdirectories ("tmp", "incoming", "errors") from other filesystem.
1. Inserting file 1. Inserting file
* The file you want to create _must_ be created in the "temp" subdirectory * The file you want to create _must_ be created in the "tmp" subdirectory
first, _not_ "incoming". Filename is arbitrary, but must be unique among first, _not_ "incoming". Filename is arbitrary, but must be unique among
all subdirectories. all subdirectories.
...@@ -148,7 +148,7 @@ subdirectories ("temp", "incoming", "errors") from other filesystem. ...@@ -148,7 +148,7 @@ subdirectories ("temp", "incoming", "errors") from other filesystem.
or complete. or complete.
For simple usage (bash scripts, etc.), just creating sufficiently random For simple usage (bash scripts, etc.), just creating sufficiently random
filename in "temp" and then moving into "incoming" may be enough. filename in "tmp" and then moving into "incoming" may be enough.
Concatenating $RANDOM couple of times will do. :) Concatenating $RANDOM couple of times will do. :)
For advanced or potentially concurrent usage inserting enough of unique For advanced or potentially concurrent usage inserting enough of unique
...@@ -159,7 +159,7 @@ subdirectories ("temp", "incoming", "errors") from other filesystem. ...@@ -159,7 +159,7 @@ subdirectories ("temp", "incoming", "errors") from other filesystem.
2. Picking up file 2. Picking up file
* Rename the file to work with into "temp" directory. * Rename the file to work with into "tmp" directory.
* Do whatever you want with contents, and when finished, rename file back * Do whatever you want with contents, and when finished, rename file back
into "incoming", or remove, or move somewhere else, or move into "errors" into "incoming", or remove, or move somewhere else, or move into "errors"
......
...@@ -65,9 +65,9 @@ class NamedFile(object): ...@@ -65,9 +65,9 @@ class NamedFile(object):
class SafeDir(object): class SafeDir(object):
""" Maildir like directory for safe file exchange. """ Maildir like directory for safe file exchange.
- Producers are expected to drop files into "temp" under globally unique - Producers are expected to drop files into "tmp" under globally unique
filename and rename it into "incoming" atomically (newfile method) filename and rename it into "incoming" atomically (newfile method)
- Workers pick files in "incoming", rename them into "temp", - Workers pick files in "incoming", rename them into "tmp",
do whatever they want, and either discard them or move into do whatever they want, and either discard them or move into
"errors" directory "errors" directory
""" """
...@@ -76,7 +76,7 @@ class SafeDir(object): ...@@ -76,7 +76,7 @@ class SafeDir(object):
self.path = self._ensure_path(p) self.path = self._ensure_path(p)
self.incoming = self._ensure_path(path.join(self.path, "incoming")) self.incoming = self._ensure_path(path.join(self.path, "incoming"))
self.errors = self._ensure_path(path.join(self.path, "errors")) self.errors = self._ensure_path(path.join(self.path, "errors"))
self.temp = self._ensure_path(path.join(self.path, "temp")) self.temp = self._ensure_path(path.join(self.path, "tmp"))
self.hostname = socket.gethostname() self.hostname = socket.gethostname()
self.pid = os.getpid() self.pid = os.getpid()
...@@ -116,7 +116,7 @@ class SafeDir(object): ...@@ -116,7 +116,7 @@ class SafeDir(object):
# which checked uniqueness among all directories by atomic # which checked uniqueness among all directories by atomic
# links. # links.
# First find and open name unique within temp # First find and open name unique within tmp
tmpname = None tmpname = None
while not tmpname: while not tmpname:
tmpname = self._get_new_name() tmpname = self._get_new_name()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment