Once the deployment is complete, BlobSeer is ready to process requests form clients. In order to manipulate blobs, the client must link against the blobseer library provided in the lib directory.
Each blob is manipulated using an object_handler. Object handlers are defined in:
Object handlers are initialized with configuration files described in deployment.
object_handler *my_blob = new object_handler("test/test.cfg");
A successfully initialized object_handler is used either to create a new blob and bind to it, or simply bind to the latest version of an existing blob.
blob_id = my_blob->create(page_size, replica_count); bool success = my_blob->get_latest(blob_id);
Once successfully bound, the object_handler will be used to access the blob:
// main access functions my_blob->read(blob_offset, size, local_buffer, version = 0); my_blob->write(blob_offset, size, local_buffer); my_blob->append(size, local_buffer); // other useful functions my_blob->get_version(); my_blob->get_size(); my_blob->get_page_size(); my_blob->get_id();
Note: The version parameter of the read method defaults to 0, which refers to the latest version of the blob.
A series of tests can be found in the test directory. The source codes are very small and demonstrate the usage object_handlers. A simple utility, create_blob, demonstrates how to create a blob. A more elaborate client application, test,demonstrates how to read and write data to/from a blob.
First, let's create a blob with a page size of 64KB and a single replica for each page. (You cannot write data smaller than chunk size)
./create_blob test.cfg 65536 1
Now let's write to the blob:
./test W 1 test.cfg
And read it back, checking to see if it was written correctly:
./test R 1 test.cfg
If everything went fine, congratulations. You have successfully compiled, deployed and tested BlobSeer. You can now move on to use it for your own storage needs.