Skip to main content

A wrapper for select object operations using boto3 on Ceph which confirms integrity of reads and heals intermittent connectivity.

Project description

codecov

A wrapper for the following boto3 s3 client operations below the multipart upload threshold of 5 GB:

  • get_object

  • head_object

  • upload_fileobj

  • copy_object

  • delete_object

Features

  • Retry connection failures

  • Confirm checksum of retrieved objects

  • Constrained interface to support simple CRUD operations for objects in existing buckets

Installation

pip install object-clerk

Examples

Initialize

clerk = ObjectClerk(host=127.0.0.1, port=8080, access_key=12342, secret_key=12342, retry_delay=1, retry_backoff=1, retry_jitter=(1, 3), retry_max_delay=5, retry_tries=3, use_ssl=False)'

Get Object

# with checksum verified

bytes_response = clerk.get_object("bucket", "object_key")

# without checksum verified

bytes_response = clerk.get_object("bucket", "object_key", verify_checksum=False)

Delete Object

clerk.delete_object("bucket", "object_key")

Get Object Info

dict_response = clerk.get_object_info("bucket", "object_key")

Copy Object

# with checksum verified

clerk.copy_object(
    "source_bucket",
    "source_object_key",
    "destination_bucket",
    "destination_object_key",
)

# without checksum verified

clerk.copy_object(
    "source_bucket",
    "source_object_key",
    "destination_bucket",
    "destination_object_key",
    verify_checksum=False
)

Upload Object

# with checksum verified

with open("file", mode='rb') as f:

    clerk.upload_object(f, "bucket", "object_key")

# without checksum verified

with open("file", mode='rb') as f:

    clerk.upload_object(f, "bucket", "object_key", verify_checksum=False)

Test

git clone git@bitbucket.org:swiant/object_store_wrapper.git

pip install -e .

export HOST=<host>

export PORT=<port>

export ACCESS_KEY=<access_key>

export SECRET_KEY=<secret_key>

pytest -v object_clerk

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

object-clerk-0.0.1rc4.tar.gz (9.9 kB view details)

Uploaded Source

File details

Details for the file object-clerk-0.0.1rc4.tar.gz.

File metadata

  • Download URL: object-clerk-0.0.1rc4.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.3

File hashes

Hashes for object-clerk-0.0.1rc4.tar.gz
Algorithm Hash digest
SHA256 012e8bb86cf8d09a8b3622b2da28b1ad58560bfbaf34a96ef9a9c2437cfd3398
MD5 e4058a36b7cc8f059018b75702b1d720
BLAKE2b-256 5f7ce23a43eeaa6e43fd9bd67ef3b7ed47b2c69dc18006437b74c427a98e21f6

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page