SOS: Scalable Object Store
4.0.0
|
Classes | |
struct | sos_part_obj_iter_pos_s |
Typedefs | |
typedef int(* | sos_part_obj_iter_fn_t )(sos_part_t part, sos_obj_t obj, void *arg) |
The callback function called by the sos_part_obj_iter() function. More... | |
typedef struct sos_part_obj_iter_pos_s * | sos_part_obj_iter_pos_t |
Functions | |
int | sos_part_create (sos_t sos, const char *name, const char *path) |
Create a new partition. More... | |
int | sos_part_delete (sos_part_t part) |
Delete a partition. More... | |
int | sos_part_move (sos_part_t part, const char *part_path) |
Move a partition. More... | |
sos_part_t | sos_part_find (sos_t sos, const char *name) |
Find a partition. More... | |
sos_part_iter_t | sos_part_iter_new (sos_t sos) |
Create a partition iterator. More... | |
void | sos_part_iter_free (sos_part_iter_t iter) |
Free the memory associated with the Iterator. More... | |
sos_part_t | sos_part_first (sos_part_iter_t iter) |
Return the first partition in the container. More... | |
sos_part_t | sos_part_next (sos_part_iter_t iter) |
Return the next partition in the container. More... | |
const char * | sos_part_name (sos_part_t part) |
Return the partition's name. More... | |
const char * | sos_part_path (sos_part_t part) |
Return the partition's path. More... | |
uint32_t | sos_part_id (sos_part_t part) |
Return the partition's id. More... | |
sos_part_state_t | sos_part_state (sos_part_t part) |
Return the partition's state. More... | |
int | sos_part_state_set (sos_part_t part, sos_part_state_t state) |
Set the state of a partition. More... | |
uint32_t | sos_part_refcount (sos_part_t part) |
Return the number of references on the partition. More... | |
void | sos_part_put (sos_part_t part) |
Drop a reference on a partition. More... | |
int | sos_part_stat (sos_part_t part, sos_part_stat_t stat) |
Return size and access data for the partition. More... | |
int64_t | sos_part_export (sos_part_t src_part, sos_t dst_sos, int reindex) |
Export the objects in a partition to another container. More... | |
int64_t | sos_part_index (sos_part_t src_part) |
void | sos_part_obj_iter_pos_init (sos_part_obj_iter_pos_t pos) |
int | sos_part_obj_iter (sos_part_t part, sos_part_obj_iter_pos_t pos, sos_part_obj_iter_fn_t fn, void *arg) |
Iterate over objects in the partition. More... | |
typedef int(* sos_part_obj_iter_fn_t)(sos_part_t part, sos_obj_t obj, void *arg) |
The callback function called by the sos_part_obj_iter() function.
Called by the sos_part_obj_iter() function for each object in the partition. If the function wishes to cancel iteration, return !0, otherwise, return 0.
sos | The container handle |
obj | The object handle |
sz | The size of the object |
arg | The 'arg' passed into sos_part_obj_iter() |
0 | Continue iterating |
!0 | Stop iterating |
int sos_part_create | ( | sos_t | sos, |
const char * | part_name, | ||
const char * | part_path | ||
) |
Create a new partition.
sos | The sos_t container handle |
part_name | The name of the new partition. |
part_path | An optional path to the partition. If null, the container path will be used. |
0 | Success |
EEXIST | The specified partition already exists |
EBADF | Invalid container handle or other storage error |
ENOMEM | Insufficient resources |
int sos_part_delete | ( | sos_part_t | part | ) |
Delete a partition.
Deletes the paritition specified by the handle. All object storage associated with the parition will be freed. The parition must be in the OFFLINE state to be deleted.
part | The partition handle |
0 | The parition was deleted |
EBUSY | The partition is not offline |
int64_t sos_part_export | ( | sos_part_t | src_part, |
sos_t | dst_sos, | ||
int | reindex | ||
) |
Export the objects in a partition to another container.
Export all of the objects in the specified partition to another container. The destination partition in the destination container will be the primary partition in the destination container.
The source partition must not be the primary partition in order to ensure that every object will be exported.
The source container (the container in which src_part is located) cannot be the same as the destination container.
src_part | The source partition handle |
dst_cont | The destination container |
reindex | Set to 1 to add exported objects to their schema indices |
>= | 0 The number of objects exported to the destination container |
<0 | An error occured, see errno for more information |
sos_part_t sos_part_find | ( | sos_t | sos, |
const char * | name | ||
) |
Find a partition.
Returns the partition handle for the partition with the name specified by the name
parameter.
The application should call sos_part_put() when finished with the partition object. Note that calling sos_part_put() too many times can result in destroying the partition.
sos | The container handle |
name | The name of the partition |
Partition | handle |
NULL | if the partition was not found |
sos_part_t sos_part_first | ( | sos_part_iter_t | iter | ) |
Return the first partition in the container.
The application should call sos_part_put() when finished with the partition object. Note that calling sos_part_put() too many times can result in destroying the partition.
iter | The partition iterator handle |
uint32_t sos_part_id | ( | sos_part_t | part | ) |
Return the partition's id.
Returns the parititions unique 32b id. This id is part of an object's sos_obj_ref_t and identifies the partition in which the object is allocated.
part | The partition handle |
void sos_part_iter_free | ( | sos_part_iter_t | iter | ) |
Free the memory associated with the Iterator.
iter | The iterator handle |
sos_part_iter_t sos_part_iter_new | ( | sos_t | sos | ) |
Create a partition iterator.
A partition iterator is used to iterate through all partitions in the container.
sos | The container handle |
int sos_part_move | ( | sos_part_t | part, |
const char * | new_part_path | ||
) |
Move a partition.
Move a partition from it's current storage location to another. Any references to objects in the partition by indices or other objects are preserved by the move.
part | The partition handle |
path | The new path for the partition. |
0 | The parition was deleted |
EBUSY | The partition is not offline |
EINVAL | The destination path is the same as the source path |
EEXIST | The destination path already exists |
EPERM | The user has insufficient privilege to write to the destination path |
const char* sos_part_name | ( | sos_part_t | part | ) |
Return the partition's name.
part | The partition handle |
sos_part_t sos_part_next | ( | sos_part_iter_t | iter | ) |
Return the next partition in the container.
The application should call sos_part_put() when finished with the partition object. Note that calling sos_part_put() too many times can result in destroying the partition.
iter | The partition iterator handle |
int sos_part_obj_iter | ( | sos_part_t | part, |
sos_part_obj_iter_pos_t | pos, | ||
sos_part_obj_iter_fn_t | fn, | ||
void * | arg | ||
) |
Iterate over objects in the partition.
This function iterates over objects allocated in the partition and calls the specified 'iter_fn' for each object. See the sos_part_obj_iter_fn_t() for the function definition.
If the the pos
argument is not NULL, it should be initialized with the sos_obj_iter_pos_init() funuction. The pos
argument will updated with the location of the next object in the store when sos_part_obj_iter() returns. This facilitates walking through a portion of the objects at a time, continuing later where the function left off.
The sos_part_obj_iter_fn_t() function indicates that the iteration should stop by returning !0. Otherwise, the sos_part_obj_iter() function will continue until all objects in the ODS have been seen.
ods | The ODS handle |
pos | The object iterator position |
iter_fn | Pointer to the function to call |
arg | A void* argument that the user wants passed to the callback function. |
0 | All objects were iterated through |
!0 | A callback returned !0 |
const char* sos_part_path | ( | sos_part_t | part | ) |
Return the partition's path.
part | The partition handle |
void sos_part_put | ( | sos_part_t | part | ) |
Drop a reference on a partition.
Partitions are reference counted. When the reference count goes to zero, it is destroyed and all of it's storage is released. The sos_part_first(), sos_part_next(), and sos_part_find() functions take a reference on behalf of the application. This reference should be dropped by the application when the application is finished with the partition.
part | The partition handle. |
uint32_t sos_part_refcount | ( | sos_part_t | part | ) |
Return the number of references on the partition.
part | The partition handle |
An | 32b integer representing the partition's reference count |
int sos_part_stat | ( | sos_part_t | part, |
sos_part_stat_t | stat | ||
) |
Return size and access data for the partition.
part | The partition handle |
stat | The stat buffer |
0 | Success |
EINVAL | The partition or stat buffer handles were NULL or the partition is not open, for example, OFFLINE. |
sos_part_state_t sos_part_state | ( | sos_part_t | part | ) |
Return the partition's state.
part | The partition handle |
int sos_part_state_set | ( | sos_part_t | part, |
sos_part_state_t | new_state | ||
) |
Set the state of a partition.
Partition state transitions are limited by the current state. If the current state is PRIMARY, there are no state changes allowed. The only way to change the state of the PRIMARY partition is to make another partition PRIMARY. When this occurs, the partition is made ACTIVE.
Any partition in the ACTIVE state can be made PRIMARY. Any partition in the ACTIVE state can be made OFFLINE and an OFFLINE partition can be made ACTIVE. Note that when a parition is made OFFLINE, all Keys that refer to objects in that partition are removed from all indices in the container.
part | The partition handle |
new_state | The desired state of the partition |
0 | The state was successfully changed |
EINVAL | The specified state is invalid given the current state of the partition. |