Hayloft is a C++-based object oriented interface to the Amazon Web Services (AWS) Simple Storage Service (S3). It is built on top of Desperadito (a subset of Desperado) and Bryan Ischo's excellent C-based libs3. Hayloft is licensed under the GNU Public License 3.0. libs3 is in turn built on top of the cURL and SSL libraries. It is designed to make S3 easy to use in small embedded systems although it is likely to be useful in any C++-based application.
Hayloft currently implements much S3 interface functionality (limited mainly by what libs3 provides).
- Service Manifest (list of buckets within a service)
- Bucket Create
- Bucket Head (metadata)
- Bucket Manifest (list of objects within a bucket)
- Bucket Delete
- Object Head (metadata)
- Object Get (using Desperado Output functors)
- Object Put (using Desperado Input functors)
- Object Delete
- Grant Get (access control list)
- Grant Set (access control list)
- Log Set (server access logging)
- Log Get (server access logging)
Different regions (a.k.a. location contraints), endpoints, and access permissions are supported. There's a wealth of unit tests that demonstrate how to use Hayloft against an live AWS S3 account. I've used the unit tests to measure differences in convergence in S3's Eventual Consistency architecture. Hayloft leverages C++ language features to make getting started with S3 easy (trivial really) in C++.
Hayloft offers a variety of mechanisms, with examples of all of them in its extensive unit and functional test suite, for managing S3 actions that include both synchronous and asynchronous behavior and single threaded and multithreaded execution.
Hayloft has some useful collateral even if you aren't interested in S3.
- Packet implements a infinite (as long as memory holds out) length bi-directional memory buffer that support prepend and append. It maintains a linked list of individual objects like PacketBuffer that are themselves bi-directional fixed length memory buffers. The combination makes it easy to build network protocol packets by prepending and appending (or, if you are quite clever, inserting) fields. Much of the building can be done in-place without copying data.
- Logger extends the Desperado Logger class by implementing a mechanism to turn individual log levels on and off, either programatically or using an environmental variable.
- Hayloft provides a simple to use set of classes based on POSIX Threads (pthreads) that makes it easy to write simple multi-threaded C++ applications: Thread, Mutex, CriticalSection, Condition, Uncancellable, and MemoryBarrier.
- Hayloft is unit tested using Google Test. It has lots of examples of how to set up and tear down individual tests or the entire test suite.
Hayloft has been tested on a Linux/GNU-based PC (Ubuntu).
Hayloft can be found on GitHub here.
Here are some articles that my alter-ego Chip Overclock has written about Hayloft.
- Up the Source Code Organization
- Abstraction in C++ Using I/O Functors
- Amazon.com's Simple Storage Service and Hayloft
- Eventual Consistency and Hayloft
- Fibonacci Scaling
- The Cost of Experimenting with the Cloud
- Managing Actions in Simple Storage Service with Hayloft
- Since when has consistency not been eventual?