-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
189 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from flama.ddd.workers.base import * # noqa | ||
from flama.ddd.workers.http import * # noqa | ||
from flama.ddd.workers.noop import * # noqa | ||
from flama.ddd.workers.worker import * # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import typing as t | ||
|
||
from flama.ddd.workers.base import BaseWorker | ||
|
||
__all__ = ["Worker"] | ||
|
||
|
||
class Worker(BaseWorker): | ||
"""Worker that does not apply any specific behavior. | ||
A basic implementation of the worker class that does not apply any specific behavior. | ||
""" | ||
|
||
async def set_up(self) -> None: | ||
"""First step in starting a unit of work.""" | ||
... | ||
|
||
async def tear_down(self, *, rollback: bool = False) -> None: | ||
"""Last step in ending a unit of work. | ||
:param rollback: If the unit of work should be rolled back. | ||
""" | ||
... | ||
|
||
async def repository_params(self) -> tuple[list[t.Any], dict[str, t.Any]]: | ||
"""Get the parameters for initialising the repositories. | ||
:return: Parameters for initialising the repositories. | ||
""" | ||
return [], {} | ||
|
||
async def commit(self) -> None: | ||
"""Commit the unit of work.""" | ||
... | ||
|
||
async def rollback(self) -> None: | ||
"""Rollback the unit of work.""" | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.