mirror of
https://github.com/th30d4y/ExecuTrace.git
synced 2026-05-26 19:36:32 +00:00
first commit
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
"""Storage factory for selecting appropriate backend."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Literal, Union
|
||||
|
||||
from exectrace.storage.json_storage import JsonStorage
|
||||
from exectrace.storage.xml_storage import XmlStorage
|
||||
|
||||
StorageBackend = Union[JsonStorage, XmlStorage]
|
||||
|
||||
|
||||
def get_storage(format_type: Literal["json", "xml"] = "json", base_dir: str | None = None) -> StorageBackend:
|
||||
"""Get storage backend by format type."""
|
||||
if format_type == "xml":
|
||||
return XmlStorage(base_dir)
|
||||
else: # default to json
|
||||
return JsonStorage(base_dir)
|
||||
Reference in New Issue
Block a user