![]() |
kinetic-c
v0.12.0
Seagate Kinetic Protocol Client Library for C
|
#include "kinetic_types.h"
Go to the source code of this file.
Functions | |
KineticVersionInfo | KineticClient_Version (void) |
Gets current version info of kinetic-c library. More... | |
KineticClient * | KineticClient_Init (KineticClientConfig *config) |
Initializes the Kinetic API and configures logging. More... | |
void | KineticClient_Shutdown (KineticClient *const client) |
Performs shutdown/cleanup of the kinetic-c client library. More... | |
KineticStatus | KineticClient_CreateSession (KineticSessionConfig *const config, KineticClient *const client, KineticSession **session) |
Creates a session with the Kinetic Device per specified configuration. More... | |
KineticStatus | KineticClient_DestroySession (KineticSession *const session) |
Closes the connection to a host. More... | |
KineticStatus | KineticClient_GetTerminationStatus (KineticSession *const session) |
Returns the reason reported in the case of the Kinetic device terminating a session in the case of a catastrophic error occurring. More... | |
KineticStatus | KineticClient_NoOp (KineticSession *const session) |
Executes a NOOP operation to test whether the Kinetic Device is operational. More... | |
KineticStatus | KineticClient_Put (KineticSession *const session, KineticEntry *const entry, KineticCompletionClosure *closure) |
Executes a PUT operation to store/update an entry on the Kinetic Device. More... | |
KineticStatus | KineticClient_Flush (KineticSession *const session, KineticCompletionClosure *closure) |
Executes a FLUSHALLDATA operation to flush pending PUTs or DELETEs. More... | |
KineticStatus | KineticClient_Get (KineticSession *const session, KineticEntry *const entry, KineticCompletionClosure *closure) |
Executes a GET operation to retrieve an entry from the Kinetic Device. More... | |
KineticStatus | KineticClient_GetPrevious (KineticSession *const session, KineticEntry *const entry, KineticCompletionClosure *closure) |
Executes a GETPREVIOUS operation to retrieve the next entry from the Kinetic Device. More... | |
KineticStatus | KineticClient_GetNext (KineticSession *const session, KineticEntry *const entry, KineticCompletionClosure *closure) |
Executes a GETNEXT operation to retrieve the next entry from the Kinetic Device. More... | |
KineticStatus | KineticClient_Delete (KineticSession *const session, KineticEntry *const entry, KineticCompletionClosure *closure) |
Executes a DELETE operation to delete an entry from the Kinetic Device. More... | |
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 Kinetic Device. More... | |
KineticStatus | KineticClient_P2POperation (KineticSession *const session, KineticP2P_Operation *const p2pOp, KineticCompletionClosure *closure) |
Executes a PEER2PEERPUSH operation allows a client to instruct a Kinetic Device to copy a set of keys (and associated value and metadata) to another Kinetic Device. More... | |
KineticVersionInfo KineticClient_Version | ( | void | ) |
Gets current version info of kinetic-c library.
Definition at line 42 of file kinetic_client.c.
References VersionInfo.
KineticClient* KineticClient_Init | ( | KineticClientConfig * | config | ) |
Initializes the Kinetic API and configures logging.
config | A configuration struct. |
Definition at line 47 of file kinetic_client.c.
References KINETIC_CLIENT_DEFAULT_MAX_THREADPOOL_THREADS, KINETIC_CLIENT_DEFAULT_READER_THREADS, KineticBus_Init(), KineticCalloc(), KineticFree(), KineticLogger_Init(), KineticClientConfig::logFile, KineticClientConfig::logLevel, KineticClientConfig::maxThreadpoolThreads, and KineticClientConfig::readerThreads.
void KineticClient_Shutdown | ( | KineticClient *const | client | ) |
Performs shutdown/cleanup of the kinetic-c client library.
client | The pointer returned from KineticClient_Init |
Definition at line 69 of file kinetic_client.c.
References KineticBus_Shutdown(), KineticFree(), and KineticLogger_Close().
KineticStatus KineticClient_CreateSession | ( | KineticSessionConfig *const | config, |
KineticClient *const | client, | ||
KineticSession ** | session | ||
) |
Creates a session with the Kinetic Device per specified configuration.
config | KineticSessionConfig structure which must be configured by the client prior to creating the device connection. .host Host name or IP address to connect to .port Port to establish socket connection on .clusterVersion Cluster version to use for the session .identity Identity to use for the session .hmacKey Key to use for HMAC calculations (NULL-terminated string) .pin PIN to use for PIN-based operations |
client | The KineticClient pointer returned from KineticClient_Init() |
session | Pointer to a KineticSession pointer that will be populated with the allocated/created session upon success. |
session
will be populated with a pointer to the session instance upon success. The client should call KineticClient_DestroySession() in order to shutdown a connection and cleanup resources when done using a KineticSession. Definition at line 76 of file kinetic_client.c.
References ByteArray::data, KineticSessionConfig::hmacKey, KineticSessionConfig::host, KINETIC_STATUS_HMAC_REQUIRED, KINETIC_STATUS_HOST_EMPTY, KINETIC_STATUS_MEMORY_ERROR, KINETIC_STATUS_SESSION_EMPTY, KINETIC_STATUS_SESSION_INVALID, KINETIC_STATUS_SUCCESS, KineticAllocator_FreeSession(), KineticAllocator_NewSession(), KineticSession_Connect(), KineticSession_Create(), ByteArray::len, LOG0, LOGF0, and KineticSessionConfig::port.
KineticStatus KineticClient_DestroySession | ( | KineticSession *const | session | ) |
Closes the connection to a host.
session | The connected KineticSession to close. The session instance will be freed by this call after closing the connection, so the pointer should not longer be used. |
Definition at line 126 of file kinetic_client.c.
References KINETIC_STATUS_SESSION_INVALID, KINETIC_STATUS_SUCCESS, KineticSession_Destroy(), KineticSession_Disconnect(), and LOG0.
KineticStatus KineticClient_GetTerminationStatus | ( | KineticSession *const | session | ) |
Returns the reason reported in the case of the Kinetic device terminating a session in the case of a catastrophic error occurring.
session | The KineticSession to query. |
Definition at line 140 of file kinetic_client.c.
References KineticSession_GetTerminationStatus().
KineticStatus KineticClient_NoOp | ( | KineticSession *const | session | ) |
Executes a NOOP
operation to test whether the Kinetic Device is operational.
session | The connected KineticSession to use for the operation. |
Definition at line 145 of file kinetic_client.c.
References KINETIC_ASSERT, KINETIC_STATUS_MEMORY_ERROR, KineticAllocator_NewOperation(), KineticBuilder_BuildNoop(), and KineticController_ExecuteOperation().
KineticStatus KineticClient_Put | ( | KineticSession *const | session, |
KineticEntry *const | entry, | ||
KineticCompletionClosure * | closure | ||
) |
Executes a PUT
operation to store/update an entry on the Kinetic Device.
session | The connected KineticSession to use for the operation. |
entry | Key/value entry for object to store. 'value' must specify the data to be stored. If a closure is provided this pointer must remain valid until the closure callback is called. |
closure | Optional closure. If specified, operation will be executed in asynchronous mode, and closure callback will be called upon completion in another thread. |
Definition at line 156 of file kinetic_client.c.
References ByteBuffer::array, ByteArray::data, KINETIC_ASSERT, KINETIC_STATUS_MEMORY_ERROR, KINETIC_STATUS_SUCCESS, KineticAllocator_FreeOperation(), KineticAllocator_NewOperation(), KineticBuilder_BuildPut(), KineticController_ExecuteOperation(), ByteArray::len, and KineticEntry::value.
KineticStatus KineticClient_Flush | ( | KineticSession *const | session, |
KineticCompletionClosure * | closure | ||
) |
Executes a FLUSHALLDATA
operation to flush pending PUTs or DELETEs.
session | The connected KineticSession to use for the operation. |
closure | Optional closure. If specified, operation will be executed in asynchronous mode, and closure callback will be called upon completion in another thread. |
Definition at line 184 of file kinetic_client.c.
References KINETIC_ASSERT, KINETIC_STATUS_MEMORY_ERROR, KineticAllocator_NewOperation(), KineticBuilder_BuildFlush(), and KineticController_ExecuteOperation().
KineticStatus KineticClient_Get | ( | KineticSession *const | session, |
KineticEntry *const | entry, | ||
KineticCompletionClosure * | closure | ||
) |
Executes a GET
operation to retrieve an entry from the Kinetic Device.
session | The connected KineticSession to use for the operation. |
entry | Key/value entry for object to retrieve. 'value' will be populated unless 'metadataOnly' is set to 'true'. If a closure is provided this pointer must remain valid until the closure callback is called. |
closure | Optional closure. If specified, operation will be executed in asynchronous mode, and closure callback will be called upon completion in another thread. |
Definition at line 253 of file kinetic_client.c.
References CMD_GET, and handle_get_command().
KineticStatus KineticClient_GetPrevious | ( | KineticSession *const | session, |
KineticEntry *const | entry, | ||
KineticCompletionClosure * | closure | ||
) |
Executes a GETPREVIOUS
operation to retrieve the next entry from the Kinetic Device.
session | The connected KineticSession to use for the operation. |
entry | Key/value entry for object to retrieve. 'value' will be populated unless 'metadataOnly' is set to 'true'. The key and value fields will be populated with the previous key and its corresponding value, according to lexicographical byte order. If a closure is provided this pointer must remain valid until the closure callback is called. |
closure | Optional closure. If specified, operation will be executed in asynchronous mode, and closure callback will be called upon completion in another thread. |
Definition at line 260 of file kinetic_client.c.
References CMD_GET_PREVIOUS, and handle_get_command().
KineticStatus KineticClient_GetNext | ( | KineticSession *const | session, |
KineticEntry *const | entry, | ||
KineticCompletionClosure * | closure | ||
) |
Executes a GETNEXT
operation to retrieve the next entry from the Kinetic Device.
session | The connected KineticSession to use for the operation. |
entry | Key/value entry for object to retrieve. 'value' will be populated unless 'metadataOnly' is set to 'true'. The key and value fields will be populated with the next key and its corresponding value, according to lexicographical byte order. If a closure is provided this pointer must remain valid until the closure callback is called. |
closure | Optional closure. If specified, operation will be executed in asynchronous mode, and closure callback will be called upon completion in another thread. |
Definition at line 267 of file kinetic_client.c.
References CMD_GET_NEXT, and handle_get_command().
KineticStatus KineticClient_Delete | ( | KineticSession *const | session, |
KineticEntry *const | entry, | ||
KineticCompletionClosure * | closure | ||
) |
Executes a DELETE
operation to delete an entry from the Kinetic Device.
session | The connected KineticSession to use for the operation. |
entry | Key/value entry for object to delete. 'value' is not used for this operation. |
closure | Optional closure. If specified, operation will be executed in asynchronous mode, and closure callback will be called upon completion in another thread. |
Definition at line 274 of file kinetic_client.c.
References KINETIC_ASSERT, KINETIC_STATUS_MEMORY_ERROR, KineticAllocator_NewOperation(), KineticBuilder_BuildDelete(), and KineticController_ExecuteOperation().
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 Kinetic Device.
session | The connected KineticSession to use for the operation |
range | KineticKeyRange specifying keys to return |
keys | ByteBufferArray to store the retrieved keys. If a closure is provided, this must point to valid memory until the closure callback is called. |
closure | Optional closure. If specified, operation will be executed in asynchronous mode, and closure callback will be called upon completion in another thread. |
Definition at line 291 of file kinetic_client.c.
References ByteBufferArray::buffers, ByteBufferArray::count, KINETIC_ASSERT, KINETIC_STATUS_MEMORY_ERROR, KineticAllocator_NewOperation(), KineticBuilder_BuildGetKeyRange(), and KineticController_ExecuteOperation().
KineticStatus KineticClient_P2POperation | ( | KineticSession *const | session, |
KineticP2P_Operation *const | p2pOp, | ||
KineticCompletionClosure * | closure | ||
) |
Executes a PEER2PEERPUSH
operation allows a client to instruct a Kinetic Device to copy a set of keys (and associated value and metadata) to another Kinetic Device.
session | The connected KineticSession to use for the operation |
p2pOp | KineticP2P_Operation pointer. This pointer needs to remain valid during the duration of the operation. The results of P2P operation(s) will be stored in the resultStatus field of this structure. |
closure | Optional closure. If specified, operation will be executed in asynchronous mode, and closure callback will be called upon completion in another thread. |
Definition at line 312 of file kinetic_client.c.
References KINETIC_ASSERT, KINETIC_STATUS_MEMORY_ERROR, KINETIC_STATUS_SUCCESS, KineticAllocator_NewOperation(), KineticBuilder_BuildP2POperation(), and KineticController_ExecuteOperation().