NATS C Client with JetStream and Streaming support  3.11.0
The nats.io C Client, Supported by Synadia Communications Inc.
Loading...
Searching...
No Matches
Object Store management

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.
 

Detailed Description

These functions allow to get information, status, etc... on a given object store.

Function Documentation

◆ objStoreOptions_Init()

NATS_EXTERN natsStatus objStoreOptions_Init ( objStoreOptions opts)

Use this before setting specific objStoreOptions options and passing it to the APIs that accept such object.

Parameters
optsthe pointer to the stack variable objStoreOptions to initialize.

◆ objStore_GetInfo()

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.

Note
The returned objStoreInfo object needs be destroyed using objStoreInfo_Destroy when no longer needed to free allocated memory.

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.

See also
objStoreInfo_Destroy
Parameters
new_infothe location where to store the pointer to the objStoreInfo object.
obsthe pointer to the objStore object.
namethe name of the object to retrieve the info for.
optsthe pointer to the objStoreOptions object, possibly NULL.

◆ objStoreInfo_Destroy()

NATS_EXTERN void objStoreInfo_Destroy ( objStoreInfo info)

Releases memory allocated for this objStoreInfo object.

Parameters
infothe pointer to the objStoreInfo object to destroy.

◆ objStore_UpdateMeta()

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 object does not exist.
  • the new name is different from the old one, and an object with the new name already exists.

The error string will add more context.

Parameters
obsthe pointer to the objStore object.
namethe name of the object.
metathe pointer to the objStoreMeta information used for the update.

◆ objStore_Delete()

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.

Parameters
obsthe pointer to the objStore object.
namethe name of the object to delete.

◆ objStore_AddLink()

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.

Note
The returned objStoreInfo object needs be destroyed using objStoreInfo_Destroy when no longer needed to free allocated memory.
See also
objStoreInfo_Destroy
Parameters
new_infothe location where to store the pointer to the objStoreInfo object, or NULL if not needed.
obsthe pointer to the objStore object.
namethe name of the link.
objthe pointer to the objStoreInfo object representing the object being linked to.

◆ objStore_AddBucketLink()

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.

Note
The returned objStoreInfo object needs be destroyed using objStoreInfo_Destroy when no longer needed to free allocated memory.
See also
objStoreInfo_Destroy
Parameters
new_infothe location where to store the pointer to the objStoreInfo object, or NULL if not needed.
obsthe pointer to the objStore object.
namethe name of the link.
bucketthe pointer to the objStore object representing the object store being linked to.

◆ objStore_Seal()

NATS_EXTERN natsStatus objStore_Seal ( objStore obs)

This function will seal the object store, no further modifications will be allowed.

Parameters
obsthe pointer to the objStore object.

◆ objStoreWatchOptions_Init()

NATS_EXTERN natsStatus objStoreWatchOptions_Init ( objStoreWatchOptions opts)

Use this before setting specific object store watcher options and passing it to objStore_Watch.

See also
objStore_Watch
Parameters
optsthe pointer to the objStoreWatchOptions object.

◆ objStore_Watch()

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:

  • IgnoreDeletes will have the watcher not pass any objects with delete markers.
  • UpdatesOnly will have the watcher only pass updates on objects (without latest info when started).
Note
The returned objStoreWatcher object needs be destroyed using objStoreWatcher_Destroy when no longer needed to free allocated memory.
See also
objStoreWatchOptions_Init
objStoreWatcher_Next
objStoreWatcher_Stop
objStoreWatcher_Destroy
Parameters
new_watcherthe location where to store the pointer to the objStoreWatcher object.
obsthe pointer to the objStore object.
optsthe pointer to the objStoreWatchOptions object, possibly NULL.

◆ objStoreWatcher_Next()

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.

Note
The returned objStoreInfo object needs be destroyed using objStoreInfo_Destroy when no longer needed to free allocated memory.
See also
objStoreInfo_Destroy
objStoreWatcher_Stop
objStoreWatcher_Destroy
Parameters
new_infothe location where to store the pointer to the objStoreInfo object.
watcherthe pointer to the objStoreWatcher object.
timeouthow long to wait (in milliseconds) for the next entry.

◆ objStoreWatcher_Stop()

NATS_EXTERN natsStatus objStoreWatcher_Stop ( objStoreWatcher watcher)

Stops the watcher.

Note
Stopping a stopped watcher returns NATS_OK.
Warning
After this call, new and existing calls to objStoreWatcher_Next (that are waiting for an update) will return with NATS_ILLEGAL_STATE.
Parameters
watcherthe pointer to the objStoreWatcher object.

◆ objStoreWatcher_Destroy()

NATS_EXTERN void objStoreWatcher_Destroy ( objStoreWatcher watcher)

Releases memory allocated for this objStoreWatcher object.

Parameters
watcherthe pointer to the objStoreWatcher object.

◆ objStore_List()

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.

Note
The returned objStoreInfoList object needs be destroyed using objStoreInfoList_Destroy when no longer needed to free allocated memory.
See also
objStoreInfoList_Destroy
Parameters
new_listthe location where to store the pointer to the objStoreInfoList object.
obsthe pointer to the objStore object.
optsthe pointer to the objStoreOptions object, possibly NULL.

◆ objStoreInfoList_Destroy()

NATS_EXTERN void objStoreInfoList_Destroy ( objStoreInfoList list)

Releases memory allocated for this list of object store informations.

Warning
All objStoreInfo objects contained in the list will become invalid after this call.
Parameters
listthe pointer to the objStoreStatusesList object.

◆ objStore_Status()

NATS_EXTERN natsStatus objStore_Status ( objStoreStatus **  new_status,
objStore obs 
)

This function retrieves the status and configuration of the bucket.

Note
The returned objStoreStatus object needs be destroyed using objStoreStatus_Destroy when no longer needed to free allocated memory.
See also
objStoreStatus_Destroy
Parameters
new_statusthe location where to store the pointer to the objStoreStatus object.
obsthe pointer to the objStore object.

◆ objStoreStatus_Destroy()

NATS_EXTERN void objStoreStatus_Destroy ( objStoreStatus status)

Releases memory allocated for this object store status object.

Parameters
statusthe pointer to the objStoreStatus object.

◆ objStore_Destroy()

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.

Parameters
obsthe pointer to the objStore object.