Index

s3-bsync / 94fa0b0

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

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
1016 Jun 2022 12:0894fa0b0Clean up repo, begin work on class abstraction and serializationJosh Stockin1480G

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

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