Skip to content
This repository
tree: 2ededd34bd
Fetching contributors…

Cannot retrieve contributors at this time

file 121 lines (117 sloc) 3.875 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
/*!
* @file voldemort.h
* @brief Main include file for Project Voldemort C/C++ Client
*
* This is the master include file for the Project Voldemort C/C++ Client
*/
/* Copyright (c) 2009 Webroot Software, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
/*!
* @mainpage
*
* This is the documentation for the Voldemort C++ client.
*
* <h2>Overview</h2>
*
* This client allows you to communicate with a Project Voldemort
* server from C++. It currently requires server routing, and does
* not directly support the serialization features of the Voldemort
* server (though it's possible to do so externally).
*
* In order to connect to a server, it must be configured to use
* Protocol Buffers as its request format. To do this, add
* @code
* request.format=pb
* @endcode
* to the server.properties file for all the Voldemort nodes in the
* cluster.
*
* <h2>Example</h2>
* @code
* #include <string>
* #include <list>
* #include <memory>
* #include <iostream>
*
* using namespace std;
* using namespace Voldemort;
*
* // ...
*
* // Initialize the bootstrap URLs. This is a list of server URLs
* // in the cluster that we use to download metadata for the
* // cluster. You only need one to be able to use the cluster, but
* // more will increase availability when initializing.
* list<string> bootstrapUrls;
* for (int i = 1; i < argc; i++) {
* bootstrapUrls.push_back(string(argv[i]));
* }
*
* // The store name is essentially a namespace on the Voldemort
* // cluster
* string storeName("test");
*
* // The ClientConfig object allows you to configure settings on how
* // we access the Voldemort cluster. The set of bootstrap URLs is
* // the only thing that must be configured.
* ClientConfig config;
* config.setBootstrapUrls(&bootstrapUrls);
*
* // We access the server using a StoreClient object. We create
* // StoreClients using a StoreClientFactory. In this case we're
* // using the SocketStoreClientFactory which will connect to a
* // Voldemort cluster over TCP.
* SocketStoreClientFactory factory(config);
* auto_ptr<StoreClient> client(factory.getStoreClient(storeName)); *
*
* // Get a value
* std::string key("hello");
* const VersionedValue* result = client->get(&key);
* VersionedValue value;
* if (result) {
* value = *result;
* cout << "Value: " << *(value.getValue()) << endl;
* } else {
* cout << "Value not set" << endl;
* }
*
* // Modify the value
* value.setValue(new string("world!"));
*
* // update the value
* client->put(&key, &value);
*
* value = *client->get(&key);
* cout << "Value: " << *(value.getValue()) << endl;
*
* // Set and then delete a key
* std::string key2("keytest");
* std::string value2("valuetest");
* client->put(&key2, &value2);
* client->deleteKey(&key2);
* @endcode
*/

#ifndef VOLDEMORT_H
#define VOLDEMORT_H

#include <voldemort/SocketStoreClientFactory.h>

#include <voldemort/BootstrapFailureException.h>
#include <voldemort/InconsistentDataException.h>
#include <voldemort/InsufficientOperationalNodesException.h>
#include <voldemort/InvalidMetadataException.h>
#include <voldemort/ObsoleteVersionException.h>
#include <voldemort/PersistenceFailureException.h>
#include <voldemort/StoreOperationFailureException.h>
#include <voldemort/UnreachableStoreException.h>

#endif /* VOLDEMORT_H */
Something went wrong with that request. Please try again.