forked from exasol/bucketfs-utils-python
-
Notifications
You must be signed in to change notification settings - Fork 1
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
3 changed files
with
165 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,157 @@ | ||
============================== | ||
Design Document Bucket Path(s) | ||
============================== | ||
|
||
Introduction | ||
============ | ||
|
||
- Purpose of the document / Problem description | ||
- Definitions and Acronyms | ||
|
||
Overview | ||
======== | ||
|
||
Design Goals | ||
============ | ||
|
||
Path Design | ||
=========== | ||
|
||
Future Considerations | ||
===================== | ||
|
||
Sudo Code Outline | ||
================= | ||
|
||
.. code-block:: python | ||
from exasol.bucketfs import PathBuilder | ||
Path = PathBuilder(credentials) | ||
udf_path = Path("bfsl://some/local/path/file.tar.gz") | ||
http_bucket_path = Path("bfs://127.0.0.1:8888/service/bucket/some/file.tar.gz") | ||
https_bucket_path = Path("bfss://127.0.0.1:8888/service/bucket/some/file.tar.gz") | ||
chroot_path = Path("bfss://127.0.0.1:8888/service/bucket/some/sub/subsub/file.tar.gz?chroot=/some/sub/") | ||
.. code-block:: python | ||
from typing import Protocol | ||
# interface / protocol or abc | ||
# Note: should mimic pathlib.Path so it can easily understood and adopted. | ||
class Pathlike(Protocol): | ||
@property | ||
def name: | ||
... | ||
@property | ||
def suffix: | ||
... | ||
@property | ||
def root: | ||
... | ||
def as_uri(): | ||
... | ||
def exists(): | ||
... | ||
def is_dir(): | ||
... | ||
def is_file(): | ||
... | ||
def read_text(): | ||
... | ||
def read_bytes(): | ||
... | ||
def write_text(): | ||
... | ||
def write_bytes(): | ||
... | ||
def unlink(): | ||
... | ||
def rmdir(): | ||
... | ||
def join() | ||
... | ||
def walk(): | ||
... | ||
def iterdir(): | ||
... | ||
# overload / for joining | ||
def __truediv__(): | ||
... | ||
# Note: needs to support Pathlike | ||
class BucketPath: | ||
protocol = ['bfs', 'bfss'] | ||
def __init__(bucket: Bucket, path): | ||
... | ||
# QUESTION: UdfPath? Do we need to distuinguish between localpaths and localpaths within udf? | ||
# Note: needs to support Pathlike | ||
class LocalPath: | ||
protocol = ['bfsl'] | ||
def __init__(path): | ||
... | ||
# Note: needs to support Pathlike | ||
# restrict a path to use a specific root, instead of the "normal" root | ||
# this shall and should work on every Pathlike | ||
class Chroot: | ||
# does not have a protocol, works on all kinds. | ||
# if ?chroot is part of the uri the path LocalPath/BucketPath needs | ||
# to be additionaly wrapped into a Chroot | ||
def __init__(self, path: Pathlike, chroot='/'): | ||
pass | ||
def PathBuilder: | ||
def __init__(*args, **kwargs): | ||
""" | ||
Pass credentails/crendentails store etc. | ||
""" | ||
pass | ||
def __call__(path, chroot='/') -> Pathlike: | ||
# type: LocalPath, BucketPath, Chroot | ||
type = _determine_type(path) | ||
facories = { | ||
"udf" = _create_udf_path, | ||
"bfs" = _create_bucket_path, | ||
"chroot" = _create_chroot_path, | ||
} | ||
factory = factory[type] | ||
return factory(args) | ||
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,7 @@ | ||
📑 Design Documents | ||
=================== | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
bucketpath |
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 |
---|---|---|
|
@@ -7,4 +7,5 @@ | |
user_guide/user_guide | ||
api | ||
developer_guide/developer_guide | ||
design/design | ||
changes/changelog |