NATS C Client with JetStream and Streaming support
3.11.0
The nats.io C Client, Supported by Synadia Communications Inc.
|
Functions | |
NATS_EXTERN natsStatus | objStoreOptions_Init (objStoreOptions *opts) |
Initializes an Object Store options structure. | |
NATS_EXTERN natsStatus | objStore_GetInfo (objStoreInfo **new_info, objStore *obs, const char *name, objStoreOptions *opts) |
Retrieves the current information for the object. | |
NATS_EXTERN void | objStoreInfo_Destroy (objStoreInfo *info) |
Destroys the ObjectStore information object. | |
NATS_EXTERN natsStatus | objStore_UpdateMeta (objStore *obs, const char *name, objStoreMeta *meta) |
Updates the metadata for the object. | |
NATS_EXTERN natsStatus | objStore_Delete (objStore *obs, const char *name) |
Deletes the named object from the object store. | |
NATS_EXTERN natsStatus | objStore_AddLink (objStoreInfo **new_info, objStore *obs, const char *name, objStoreInfo *obj) |
Adds a link to another object. | |
NATS_EXTERN natsStatus | objStore_AddBucketLink (objStoreInfo **new_info, objStore *obs, const char *name, objStore *bucket) |
Adds a link to another object store. | |
NATS_EXTERN natsStatus | objStore_Seal (objStore *obs) |
Seals the object store. | |
NATS_EXTERN natsStatus | objStoreWatchOptions_Init (objStoreWatchOptions *opts) |
Initializes the object store watcher options object. | |
NATS_EXTERN natsStatus | objStore_Watch (objStoreWatcher **new_watcher, objStore *obs, objStoreWatchOptions *opts) |
Watches for updates to objects in the store. | |
NATS_EXTERN natsStatus | objStoreWatcher_Next (objStoreInfo **new_info, objStoreWatcher *watcher, int64_t timeout) |
Returns the next object store information for this object store watcher. | |
NATS_EXTERN natsStatus | objStoreWatcher_Stop (objStoreWatcher *watcher) |
Stops the object store watcher. | |
NATS_EXTERN void | objStoreWatcher_Destroy (objStoreWatcher *watcher) |
Destroys the object store's watcher object. | |
NATS_EXTERN natsStatus | objStore_List (objStoreInfoList **new_list, objStore *obs, objStoreOptions *opts) |
Lists information about objects in the object store. | |
NATS_EXTERN void | objStoreInfoList_Destroy (objStoreInfoList *list) |
Destroys the list of object informations. | |
NATS_EXTERN natsStatus | objStore_Status (objStoreStatus **new_status, objStore *obs) |
Retreive the status and configuration of the bucket. | |
NATS_EXTERN void | objStoreStatus_Destroy (objStoreStatus *status) |
Destroys the object store status object. | |
NATS_EXTERN void | objStore_Destroy (objStore *obs) |
Destroys an object store object. | |
These functions allow to get information, status, etc... on a given object store.
NATS_EXTERN natsStatus objStoreOptions_Init | ( | objStoreOptions * | opts | ) |
Use this before setting specific objStoreOptions options and passing it to the APIs that accept such object.
opts | the pointer to the stack variable objStoreOptions to initialize. |
NATS_EXTERN natsStatus objStore_GetInfo | ( | objStoreInfo ** | new_info, |
objStore * | obs, | ||
const char * | name, | ||
objStoreOptions * | opts | ||
) |
Retrieves the current information for the object, containing the object's metadata and instance information.
If the object does not exist, NATS_NOT_FOUND will be returned.
The objStoreOptions.ShowDeleted option can be supplied to return an object even if it was marked as deleted.
If opts
is not NULL
, the objStoreOptions.ShowDeleted can be used to get information about an object within the store, even if it has been deleted.
new_info | the location where to store the pointer to the objStoreInfo object. |
obs | the pointer to the objStore object. |
name | the name of the object to retrieve the info for. |
opts | the pointer to the objStoreOptions object, possibly NULL . |
NATS_EXTERN void objStoreInfo_Destroy | ( | objStoreInfo * | info | ) |
Releases memory allocated for this objStoreInfo object.
info | the pointer to the objStoreInfo object to destroy. |
NATS_EXTERN natsStatus objStore_UpdateMeta | ( | objStore * | obs, |
const char * | name, | ||
objStoreMeta * | meta | ||
) |
This will update the metadata for the object.
The status NATS_ILLEGAL_STATE may be returned if:
The error string will add more context.
obs | the pointer to the objStore object. |
name | the name of the object. |
meta | the pointer to the objStoreMeta information used for the update. |
NATS_EXTERN natsStatus objStore_Delete | ( | objStore * | obs, |
const char * | name | ||
) |
This will delete the named object from the object store. If the object does not exist, the error NATS_NOT_FOUND will be returned. If the object is already deleted, no error will be returned.
All chunks for the object will be purged, and the object will be marked as deleted.
obs | the pointer to the objStore object. |
name | the name of the object to delete. |
NATS_EXTERN natsStatus objStore_AddLink | ( | objStoreInfo ** | new_info, |
objStore * | obs, | ||
const char * | name, | ||
objStoreInfo * | obj | ||
) |
A link is a reference to another object. The provided name is the name of the link object. The provided objStoreInfo is the info of the object being linked to.
The error NATS_ILLEGAL_STATE is returned if an object with given name already exists, or if the provided object is a link.
new_info | the location where to store the pointer to the objStoreInfo object, or NULL if not needed. |
obs | the pointer to the objStore object. |
name | the name of the link. |
obj | the pointer to the objStoreInfo object representing the object being linked to. |
NATS_EXTERN natsStatus objStore_AddBucketLink | ( | objStoreInfo ** | new_info, |
objStore * | obs, | ||
const char * | name, | ||
objStore * | bucket | ||
) |
A link is a reference to another object store. The provided name is the name of the link object.
The provided objStore is the object store being linked to.
The error NATS_ILLEGAL_STATE is returned if an object with given name already exists.
new_info | the location where to store the pointer to the objStoreInfo object, or NULL if not needed. |
obs | the pointer to the objStore object. |
name | the name of the link. |
bucket | the pointer to the objStore object representing the object store being linked to. |
NATS_EXTERN natsStatus objStore_Seal | ( | objStore * | obs | ) |
This function will seal the object store, no further modifications will be allowed.
obs | the pointer to the objStore object. |
NATS_EXTERN natsStatus objStoreWatchOptions_Init | ( | objStoreWatchOptions * | opts | ) |
Use this before setting specific object store watcher options and passing it to objStore_Watch.
opts | the pointer to the objStoreWatchOptions object. |
NATS_EXTERN natsStatus objStore_Watch | ( | objStoreWatcher ** | new_watcher, |
objStore * | obs, | ||
objStoreWatchOptions * | opts | ||
) |
This will create a watcher for any updates to objects in the store. By default, the watcher will send the latest information for each object and all future updates. The call to objStoreWatcher_Next will return a NULL
objStoreInfo with status NATS_OK when it has received all initial values.
The watcher can be configured by initializing a objStoreWatchOptions structure with objStoreWatchOptions_Init and setting the following properties:
new_watcher | the location where to store the pointer to the objStoreWatcher object. |
obs | the pointer to the objStore object. |
opts | the pointer to the objStoreWatchOptions object, possibly NULL . |
NATS_EXTERN natsStatus objStoreWatcher_Next | ( | objStoreInfo ** | new_info, |
objStoreWatcher * | watcher, | ||
int64_t | timeout | ||
) |
Returns the next object store information for this watcher. The new_info
may be NULL
(with NATS_OK status) to indicate that the initial state has been retrieved.
If a thread is waiting on this call, it can be canceled with a call to objStoreWatcher_Stop.
new_info | the location where to store the pointer to the objStoreInfo object. |
watcher | the pointer to the objStoreWatcher object. |
timeout | how long to wait (in milliseconds) for the next entry. |
NATS_EXTERN natsStatus objStoreWatcher_Stop | ( | objStoreWatcher * | watcher | ) |
Stops the watcher.
watcher | the pointer to the objStoreWatcher object. |
NATS_EXTERN void objStoreWatcher_Destroy | ( | objStoreWatcher * | watcher | ) |
Releases memory allocated for this objStoreWatcher object.
watcher | the pointer to the objStoreWatcher object. |
NATS_EXTERN natsStatus objStore_List | ( | objStoreInfoList ** | new_list, |
objStore * | obs, | ||
objStoreOptions * | opts | ||
) |
This function will return a objStoreInfoList object that contains the objStoreInfo for objects in the store.
If the object store is empty, this function will return NATS_NOT_FOUND.
To get information about deleted objects, initialize the options with objStoreOptions_Init, then set objStoreOptions.ShowDeleted to true and pass the options to this call.
new_list | the location where to store the pointer to the objStoreInfoList object. |
obs | the pointer to the objStore object. |
opts | the pointer to the objStoreOptions object, possibly NULL . |
NATS_EXTERN void objStoreInfoList_Destroy | ( | objStoreInfoList * | list | ) |
Releases memory allocated for this list of object store informations.
list | the pointer to the objStoreStatusesList object. |
NATS_EXTERN natsStatus objStore_Status | ( | objStoreStatus ** | new_status, |
objStore * | obs | ||
) |
This function retrieves the status and configuration of the bucket.
new_status | the location where to store the pointer to the objStoreStatus object. |
obs | the pointer to the objStore object. |
NATS_EXTERN void objStoreStatus_Destroy | ( | objStoreStatus * | status | ) |
Releases memory allocated for this object store status object.
status | the pointer to the objStoreStatus object. |
NATS_EXTERN void objStore_Destroy | ( | objStore * | obs | ) |
This will simply free memory resources in the library for this object store object, but does not delete the object store in the server.
obs | the pointer to the objStore object. |