Index

s3-bsync / 2414eba

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

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
1419 Jun 2022 18:222414ebaDeserialization and directory mappingJosh Stockin11210G

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

application/x-python1472 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 bucket_name = ""
20 directory_maps = []
21 fileobjects = []
22
23 def __init__(self, bucket_name):
24 self.bucket_name = bucket_name
25
26 def create_dirmap(
27 self,
28 local_path,
29 s3_prefix,
30 gz_compress=0,
31 recursive=True,
32 gpg_enabled=False,
33 gpg_email="",
34 ):
35 dirmap = sync_directory_map()
36 dirmap.local_path = local_path
37 dirmap.s3_prefix = s3_prefix
38 dirmap.gz_compress = gz_compress
39 dirmap.recursive = recursive
40 dirmap.gpg_enabled = gpg_enabled
41 dirmap.gpg_email = gpg_email
42 self.directory_maps.append(dirmap)
43
44 def create_fileobject(self, key, modified, etag, size):
45 fileobject = sync_fileobject()
46 fileobject.key = None
47 fileobject.modified = 0
48 fileobject.etag = None
49 fileobject.size = 0
50 self.fileobjects.append(fileobject)
51