27 #include <sys/param.h>
33 KineticSession* session;
55 snprintf(keySuffix,
sizeof(keySuffix),
"%02d", objIndex);
70 fprintf(stderr,
"Kinetic PUT of object %d to host %s failed w/ status: %s\n",
78 printf(
"File stored on Kinetic Device across %d entries\n", objIndex);
81 int main(
int argc,
char** argv)
87 KineticSession* session;
93 if (client == NULL) {
return 1; }
94 const char HmacKeyString[] =
"asdfasdf";
104 fprintf(stderr,
"Failed connecting to the Kinetic device w/status: %s\n",
110 const char* dataFile =
"test/support/data/test.data";
113 char* buf = malloc(st.st_size);
114 int fd = open(dataFile, O_RDONLY);
115 long dataLen = read(fd, buf, st.st_size);
118 fprintf(stderr,
"Failed reading data file to store: %s\n", dataFile);
123 write_args* writeArgs = calloc(1,
sizeof(write_args));
124 writeArgs->session = session;
131 gettimeofday(&now, NULL);
132 snprintf(writeArgs->keyPrefix,
sizeof(writeArgs->keyPrefix),
"%010ld_", now.tv_sec);
145 strcpy(writeArgs->ip, sessionConfig.
host);
148 printf(
"\nWriting data file to the Kinetic device...\n");
void ByteBuffer_Reset(ByteBuffer *buffer)
Structure for an embedded ByteArray as a buffer.
int main(int argc, char **argv)
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.
#define KINETIC_OBJ_SIZE
Max object/value size.
void store_data(write_args *args)
ByteBuffer * ByteBuffer_AppendArray(ByteBuffer *buffer, const ByteArray array)
KineticStatus KineticClient_DestroySession(KineticSession *const session)
Closes the connection to a host.
char host[256]
Host name/IP address of Kinetic Device.
ByteBuffer * ByteBuffer_AppendCString(ByteBuffer *buffer, const char *data)
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)
#define KINETIC_PORT
Default kinetic port.
They can be made persistent when the drive chooses, or when a subsequent FLUSH is sent to the drive...
long ByteBuffer_BytesRemaining(const ByteBuffer buffer)
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.
ByteArray ByteBuffer_Consume(ByteBuffer *buffer, size_t max_len)
#define KINETIC_DEFAULT_KEY_LEN
Default key length.
KineticStatus
Kinetic status codes.
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 value
Value data associated with the key.