Motr
M0
|
#include "helpers/ufid.h"
Go to the source code of this file.
Macros | |
#define | __MOTR_HELPERS_HELPERS_H__ |
Functions | |
M0_INTERNAL int | m0_ufid_init (struct m0_client *m0c, struct m0_ufid_generator *gr) |
M0_INTERNAL void | m0_ufid_fini (struct m0_ufid_generator *gr) |
int | m0_ufid_new (struct m0_ufid_generator *gr, uint32_t nr_ids, uint32_t nr_skip_ids, struct m0_uint128 *id128) |
int | m0_ufid_next (struct m0_ufid_generator *gr, uint32_t nr_ids, struct m0_uint128 *id128) |
M0_INTERNAL void m0_ufid_fini | ( | struct m0_ufid_generator * | gr | ) |
M0_INTERNAL int m0_ufid_init | ( | struct m0_client * | m0c, |
struct m0_ufid_generator * | gr | ||
) |
Initialises Unique File/object ID (UFID) generator.
m0c | The Client instance contains required process FID. |
gr | The UFID generator to be initialised. |
Definition at line 248 of file ufid.c.
int m0_ufid_new | ( | struct m0_ufid_generator * | gr, |
uint32_t | nr_ids, | ||
uint32_t | nr_skip_ids, | ||
struct m0_uint128 * | id128 | ||
) |
Primary interface to obtain one or more unique file/object IDs of 128 bits.
m0_ufid_new() obtains new FID range which is unique across nodes/processes.
Input Params:
gr | Pointer to an UFID generator. |
nr_ids | Number of IDs that should be allocated. nr_ids value cannot be greater than (2^20-1). |
nr_skip_ids | Number of FIDs to skip. It invalidates nr_skip_ids ID range and cannot be greater than (2^20-1). |
id128[Output] | Starting ID of generated range. |
Error Values: -EINVAL In case of errors in parameters. -ETIME In case clock errors are detected. -EPERM In case module is not initialized before invoking this interface.
Definition at line 298 of file ufid.c.
int m0_ufid_next | ( | struct m0_ufid_generator * | gr, |
uint32_t | nr_ids, | ||
struct m0_uint128 * | id128 | ||
) |
m0_ufid_next() is a simple wrapper of m0_ufid_new() which always tries to allocate FID range starting from current available FID.
Definition at line 338 of file ufid.c.