Index

s3-bsync / 8506c93

Bidirectional syncing tool to sync local filesystem directories with S3 buckets. (Incomplete)

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
1528 Jun 2022 22:408506c93Update dataclass structuresJosh Stockin124G

Blob @ s3-bsync / src / classes / sync_managed_bucket.py

application/x-python1468 bytesdownload raw
1# s3-bsync Copyright (c) 2021 Joshua Stockin
2# <https://joshstock.in>
3# <https://git.joshstock.in/s3-bsync>
4#
5# This software is licensed and distributed under the terms of the MIT License.
6# See the MIT License in the LICENSE file of this project's root folder.
7#
8# This comment block and its contents, including this disclaimer, MUST be
9# preserved in all copies or distributions of this software's source.
10
11
12from .sync_directory_map import sync_directory_map
13from .sync_fileobject import sync_fileobject
14
15__all__ = ["sync_managed_bucket"]
16
17
18class sync_managed_bucket:
19 def __init__(self, bucket_name):
20 self.bucket_name = bucket_name
21 self.directory_maps = []
22 self.fileobjects = []
23
24 def create_dirmap(
25 self,
26 local_path,
27 s3_prefix,
28 gz_compress=0,
29 recursive=True,
30 gpg_enabled=False,
31 gpg_email="",
32 ):
33 dirmap = sync_directory_map()
34 dirmap.local_path = local_path
35 dirmap.s3_prefix = s3_prefix
36 dirmap.gz_compress = gz_compress
37 dirmap.recursive = recursive
38 dirmap.gpg_enabled = gpg_enabled
39 dirmap.gpg_email = gpg_email
40 self.directory_maps.append(dirmap)
41
42 def create_fileobject(self, key, modified, etag, size):
43 fileobject = sync_fileobject()
44 fileobject.key = None
45 fileobject.modified = 0
46 fileobject.etag = None
47 fileobject.size = 0
48 self.fileobjects.append(fileobject)
49