Giter Club home page Giter Club logo

libmarias3's Introduction

libMariaS3

Documentation Status

This is a lightweight C library to read/write to AWS S3 buckets using objects in memory.

You will need an access key which for AWS can be created at the AWS security crenditials page.

Compiling

autoreconf -fi
./configure
make

Testing

libMariaS3 comes with a basic test suite which we recommend executing, especially if you are building for a new platform.

You will need the following OS environment variables set to run the tests:

Variable Desription
S3KEY Your AWS access key
S3SECRET Your AWS secret key
S3REGION The AWS region (for example us-east-1)
S3BUCKET The S3 bucket name
S3HOST OPTIONAL hostname for non-AWS S3 service
S3PORT OPTIONAL port for non-AWS S3 service
S3USEHTTP Set to 1 if the host uses http instead of https
S3NOVERIFY Set to 1 if the host should not use SSL verification

If you have minion installed, you should be able to use same settings as used by MariaDB mtr s3 tests:

export S3KEY=minio export S3SECRET=minioadmin export S3REGION= export S3BUCKET=storage-engine export S3HOST=127.0.0.1 export S3PORT=9000 export S3USEHTTP=1

The test suite is automatically built along with the library and can be executed with make check or make distcheck.

Before pushing, please ALWAYS ensure that make check and make distcheck works!

Credits

The libMariaS3 authors are:

libMariaS3 uses the following Open Source projects:

libmarias3's People

Contributors

benthompson15 avatar drrtuy avatar grooverdan avatar linuxjedi avatar markus456 avatar montywi avatar ottok avatar pleblanc1976 avatar spetrunia avatar tntnatbry avatar vuvova avatar xenu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libmarias3's Issues

Investigate using CURLOPT_POSTFIELDS

This is a zero copy / callback way of sending data rather than using READFUNCTION. In theory it should be faster but we may have to massage headers a little.

Reuse curl connections

We are calling curl_easy_cleanup() on every request. This stops curl from reusing existing connections.

We need a way of keeping the curl handle in a thread safe way so that connections are reused.

Amazon domain match needs to be a bit wider

It can really be .amazonaws.. The domain can be prefixed in a few ways with the region (such as s3-us-east-1. or s3.us-east-1.) and the postfix can be country specific (China is the main example of this).

Remove ISO646 tokens

In ticket #33 it was decided that we should remove ISO646 tokens from the codebase and stick to more traditional conventions. This ticket is to track that code change

Typo in build_request_uri will cause requests to fail

Look at the else-branch this code:

    if (protocol_version == 1)
    {
      snprintf(uri_buffer, MAX_URI_LENGTH - 1, "%s://%s/%s%s", protocol,
               domain,
               bucket,
               object);
    }
    else
    {
      snprintf(uri_buffer, MAX_URI_LENGTH - 1, "%s://%s.%s%s", protocol,
               bucket, domain,
               object);
    }

it will print:

Protocol://Bucket.DomainObject

which is obviously incorrect, domain and bucket are swapped (see the if-branch for an example of correct printout)

Basic test sometimes fails

t/basic sometimes fails. I think this is due to running get and status before S3 is ready to serve the file.

How to use it in windows?

i want use this project in windows ,but i donnot konw ,how to compile it in windows? i need some help ,think you

Check libcurl linkage

We currently require linkage of end application to libcurl. I don't think this is required any more.

Fix package building

RPM package building is definitely broken (I haven't added the templates). DEB packaging is untested. Need to fix these.

Add streaming async API

For large object we should have a streaming async read/write API so we don't have to buffer the entire object in RAM. The hooks already exist in the curl API we are using to do this, just a frontend is needed.

Improve large file ms3_get performance

ms3_get()'s callback is called every 16KB of data. We call a realloc every time. This eats up a large amount of CPU. We should create a more intelligent growing buffer.

Cannot use Google Cloud's S3 API

Google's implementation of S3 API uses key lengths which are out of spec. This causes auth to fail. We need to support variable key lengths.

Rename ms3_thread_init()

Need to come up with a better name / alias. Could maybe reuse ms3_init() now that it is deprecated and removed?

Race condition crash with OpenSSL <= 1.0.2

Curl build with OpenSSL needs some thread locking callback sets (GnuTLS also affected). OpenSSL 1.1 is not affected. If these are not set then crashes in OpenSSL can happen when many threads are using libMariaS3 simultaneously.

Example code to be implemented:

https://curl.haxx.se/libcurl/c/threaded-ssl.html

The problem is going to be detection at build time as to what curl was linked to (can't use curl-config --ssl-backends as it doesn't exists in Debian Jessie). I may make this a manual flag for now.

Add ms3_free()

To free after get requests. This is due to things such as custom allocators.

Improve error messages

The problem is twofold:

  1. Some parts of the test suite don't show what the return error code is when an error occurs.

  2. We need a way of gaining the error message from S3.

Tag libmarias3-3.1.2 does not build

The 3.1.2 tag doesn't build as it uses non-C90 code:

src/xml.c: In function ‘xml_string_equals’:
src/xml.c:207:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
  207 |         size_t i = 0; for (; i < a->length; ++i) {
      |         ^~~~~~
src/xml.c: In function ‘xml_string_clone’:
src/xml.c:226:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
  226 |         uint8_t* clone = ms3_ccalloc(s->length + 1, sizeof(uint8_t));
      |         ^~~~~~~
src/xml.c: In function ‘xml_node_free’:
src/xml.c:277:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
  277 |         struct xml_attribute** at = node->attributes;
      |         ^~~~~~
src/xml.c:284:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
  284 |         struct xml_node** it = node->children;
      |         ^~~~~~
src/xml.c: In function ‘xml_parser_error’:
src/xml.c:321:31: error: comparison of unsigned expression in ‘< 0’ is always false [-Werror=type-limits]
  321 |         #define max(X,Y) ((X) > (Y) ? (X) : (Y))
      |                               ^
src/xml.c:322:28: note: in expansion of macro ‘max’
  322 |         size_t character = max(0, min(parser->length, parser->position + offset));

This problem is fixed by commit 8727cf7 that right after the tag.

Please create a new tag with a commit that works when the documented build instructions are used.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.