27 #include <sys/param.h>
31 static bool create_entries(KineticSession *
const session,
const int count);
33 int main(
int argc,
char** argv)
39 KineticSession* session;
45 if (client == NULL) {
return 1; }
46 const char HmacKeyString[] =
"asdfasdf";
56 fprintf(stderr,
"Failed connecting to the Kinetic device w/status: %s\n",
62 printf(
"Storing some entries on the device...\n");
63 const size_t numKeys = 3;
69 const size_t keyLen = 64;
70 uint8_t startKeyData[keyLen], endKeyData[keyLen];
74 .startKeyInclusive =
true,
75 .endKeyInclusive =
true,
78 uint8_t keysData[numKeys][keyLen];
88 fprintf(stderr,
"FAILURE: Failed retrieving key range from device!\n");
93 fprintf(stderr,
"FAILURE: Unexpected number of keys in returned range!\n");
96 if (keyBuff[0].bytesUsed != strlen(
"key_prefix_00")) {
97 fprintf(stderr,
"FAILURE: Key 0 length check failed!\n");
100 if (keyBuff[1].bytesUsed != strlen(
"key_prefix_01")) {
101 fprintf(stderr,
"FAILURE: Key 1 length check failed!\n");
104 if (keyBuff[2].bytesUsed != 0) {
105 fprintf(stderr,
"FAILURE: Key 2 was not empty as expected!\n");
112 printf(
"Key range retrieved successfully!\n");
119 static const ssize_t sz = 20;
123 for (
int i = 0; i < count; i++) {
130 .value = ValueBuffer,
Structure for an embedded ByteArray as a buffer.
KineticStatus KineticClient_CreateSession(KineticSessionConfig *const config, KineticClient *const client, KineticSession **session)
Creates a session with the Kinetic Device per specified configuration.
Structure used to specify the configuration for a session.
KineticStatus KineticClient_DestroySession(KineticSession *const session)
Closes the connection to a host.
char host[256]
Host name/IP address of Kinetic Device.
const char * Kinetic_GetStatusDescription(KineticStatus status)
Provides a string representation for a KineticStatus code.
ByteBuffer ByteBuffer_Create(void *data, size_t max_len, size_t used)
Kinetic Key Range request structure.
KineticStatus KineticClient_GetKeyRange(KineticSession *const session, KineticKeyRange *range, ByteBufferArray *keys, KineticCompletionClosure *closure)
Executes a GETKEYRANGE operation to retrieve a set of keys in the range specified range from the Kine...
#define KINETIC_PORT
Default kinetic port.
ByteBuffer startKey
Required bytes, the beginning of the requested range.
int main(int argc, char **argv)
const char * logFile
Path to log file. Specify 'stdout' to log to STDOUT or NULL to disable logging.
ByteBuffer key
Key associated with the object stored on disk.
ByteBuffer ByteBuffer_CreateAndAppendFormattedCString(void *data, size_t max_len, const char *format,...)
KineticStatus
Kinetic status codes.
static bool create_entries(KineticSession *const session, const int count)
KineticStatus KineticClient_Put(KineticSession *const session, KineticEntry *const entry, KineticCompletionClosure *closure)
Executes a PUT operation to store/update an entry on the Kinetic Device.
Configuration values for the KineticClient connection.
void KineticClient_Shutdown(KineticClient *const client)
Performs shutdown/cleanup of the kinetic-c client library.
KineticClient * KineticClient_Init(KineticClientConfig *config)
Initializes the Kinetic API and configures logging.
ByteArray ByteArray_CreateWithCString(const char *str)
ByteBuffer ByteBuffer_CreateAndAppendCString(void *data, size_t max_len, const char *value)