Skip to content

Commit

Permalink
Merge pull request #205 from flyingcircusio/improve-trash-docs
Browse files Browse the repository at this point in the history
Improve documentation of `batou_ext.file.DeploymentTrash`
  • Loading branch information
frlan authored Dec 10, 2024
2 parents 1f2f258 + 7dd1837 commit 4d9e5a6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGES.d/20241209_075336_cz_improve_trash_docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Improve documentation of `batou_ext.file.DeploymentTrash`
25 changes: 15 additions & 10 deletions src/batou_ext/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,20 +148,25 @@ def update(self):


class DeploymentTrash(batou.component.Component):
"""
A trash folder that is regularly cleaned up by systemd's tmpfiles.
Files and Folders can be moved in here for asynchronous deletion that is not tied to the deployment.
Due to this component being commonly used to offload deleting very large files, it also supports adding IOPS limits.
"""A trash folder that is regularly cleaned up by systemd's tmpfiles.
Files and Folders can be moved in here for asynchronous deletion that is
not tied to the deployment. Due to this component being commonly used to
offload deleting very large files, it also supports adding IOPS limits.
```python
self.trash = DeploymentTrash(read_iops_limit = 250, write_iops_limit = 250)
self += self.trash
def configure(self):
self.trash = DeploymentTrash(read_iops_limit=250, write_iops_limit=250)
self += self.trash
def update(self):
# files that are created here should not be part of the deployment but
# rather a sideproduct for example a cache directory or build artefacts
# that are generated by some script
large_folder = do_something_that_generates_a_lot_of_byproducts()
self.trash.discard(large_folder)
# files that are created here should not be part of the deployment but rather a sideproduct
# for example a cache directory or build artefacts that are generated by some script
large_folder = do_something_that_generates_a_lot_of_byproducts()
self.trash.discard(large_folder)
```
"""

Expand Down

0 comments on commit 4d9e5a6

Please sign in to comment.