Barrelfish
|
Header file for the octopus get/set API. More...
Macros | |
#define | SET_DEFAULT (0x0) |
#define | SET_SEQUENTIAL (0x1) |
#define | SET_TRANSIENT (0x1 << 1) |
Functions | |
errval_t | oct_get_names (char ***names, size_t *, const char *,...) |
Retrieve all record names matching a given query. More... | |
errval_t | oct_parse_names (char *input, char ***names, size_t *) |
Parses output from get_names call and stores it in an array. More... | |
void | oct_free_names (char **, size_t) |
Helper function to free an array of strings. More... | |
errval_t | oct_get (char **, const char *,...) |
Gets one record matching the given query. More... | |
errval_t | oct_set (const char *,...) |
Sets a record. More... | |
errval_t | oct_get_with_idcap (char **, struct capref) |
Gets one record using the ID capability as the key/name. More... | |
errval_t | oct_set_with_idcap (struct capref, const char *,...) |
Sets a record using the ID capability as the name/key of the record. More... | |
errval_t | oct_mset (oct_mode_t, const char *,...) |
Sets a record. More... | |
errval_t | oct_set_get (oct_mode_t, char **, const char *,...) |
Sets a record and returns and in case of no error returns it to the client. More... | |
errval_t | oct_del (const char *,...) |
Deletes all records matching the given query. More... | |
errval_t | oct_exists (const char *,...) |
Checks if a result for a given query exists. More... | |
errval_t | oct_wait_for (char **, const char *,...) |
Waits until a given record exists. More... | |
errval_t | oct_read (const char *, const char *,...) |
Reads the content of a record string based on the provided format. Currently supported d (int64_t*), f (double*?), s (char**). More... | |
Header file for the octopus get/set API.
#define SET_DEFAULT (0x0) |
Normal set mode for records.
#define SET_SEQUENTIAL (0x1) |
Append a monotonically increasing number (based on the record name) to the name of the record.
#define SET_TRANSIENT (0x1 << 1) |
Record gets deleted as soon as the domain has ended it's execution.
errval_t oct_del | ( | const char * | query, |
... | |||
) |
Deletes all records matching the given query.
query | Specifies the record(s) to be deleted. |
... | Additional arguments to format the query using vsprintf. |
SYS_ERR_OK | |
OCT_ERR_NO_RECORD | |
OCT_ERR_NO_RECORD_NAME | |
OCT_ERR_ENGINE_FAIL | |
OCT_ERR_PARSER_FAIL | TODO: Atm only name of record is included in del query on server. |
errval_t oct_exists | ( | const char * | query, |
... | |||
) |
Checks if a result for a given query exists.
query | Results are searched based on the query. |
... | Additional arguments to format the query using vsprintf. |
SYS_ERR_OK | |
OCT_ERR_NO_RECORD | |
OCT_ERR_PARSER_FAIL | |
OCT_ERR_ENGINE_FAIL |
void oct_free_names | ( | char ** | names, |
size_t | len | ||
) |
Helper function to free an array of strings.
Frees all entries of the array and the array itself.
names | Non-null array of strings. |
len | Size of the names array |
errval_t oct_get | ( | char ** | data, |
const char * | query, | ||
... | |||
) |
Gets one record matching the given query.
[out] | data | Record returned by the server. |
[in] | query | The query sent to the server. |
... | Additional arguments to format the query using vsprintf. |
SYS_ERR_OK | |
OCT_ERR_NO_RECORD | |
OCT_ERR_AMBIGOUS_QUERY | TODO! |
OCT_ERR_PARSER_FAIL | |
OCT_ERR_ENGINE_FAIL |
errval_t oct_get_names | ( | char *** | names, |
size_t * | len, | ||
const char * | query, | ||
... | |||
) |
Retrieve all record names matching a given query.
[out] | names | Names of all records matching the query. Needs to be freed by the client (use oct_free_names) in case of SYS_ERR_OK/LIB_ERR_MALLOC_FAIL. |
[out] | size | Number of records matching the query. 0 in case of error. |
[in] | query | Query sent to the server |
... | Parameters used to build query with help of vsprintf. |
SYS_ERR_OK | |
OCT_ERR_NO_RECORD | |
OCT_ERR_PARSER_FAIL | |
OCT_ERR_ENGINE_FAIL | |
LIB_ERR_MALLOC_FAIL |
errval_t oct_get_with_idcap | ( | char ** | data, |
struct capref | idcap | ||
) |
Gets one record using the ID capability as the key/name.
[out] | data | Record returned by the server. |
[in] | idcap | ID capability used as the key/name of the record. |
SYS_ERR_OK | |
OCT_ERR_NO_RECORD | |
OCT_ERR_PARSER_FAIL | |
OCT_ERR_ENGINE_FAIL |
errval_t oct_mset | ( | oct_mode_t | mode, |
const char * | query, | ||
... | |||
) |
Sets a record.
query | The record to set. |
mode | A combination of mode bits (see getset.h). |
... | Additional arguments to format the query using vsprintf. |
SYS_ERR_OK | |
OCT_ERR_NO_RECORD_NAME | |
OCT_ERR_PARSER_FAIL | |
OCT_ERR_ENGINE_FAIL |
errval_t oct_parse_names | ( | char * | input, |
char *** | names, | ||
size_t * | len | ||
) |
Parses output from get_names call and stores it in an array.
[in] | input | Comma separated string of names |
[out] | names | Array of strings containing all names |
[out] | len | Size of array. |
LIB_ERR_MALLOC_FAIL | |
SYS_ERR_OK |
errval_t oct_read | ( | const char * | record, |
const char * | format, | ||
... | |||
) |
Reads the content of a record string based on the provided format. Currently supported d (int64_t*), f (double*?), s (char**).
ATTENTION: Currently we only parse 64-bit numbers (with d). This function tends to behave badly when calling it with 32bit pointers (i.e., oct_read(rec, "_ {iref: 1}", (iref_t) iref);) Don't do it!
: docs && support proper scan types from (inttypes.h)
record | Record to read. |
format | What you want to read. |
... | Values read are stored in the provided arguments. |
SYS_ERR_OK | |
OCT_ERR_ATTRIBUTE_NOT_FOUND | |
OCT_ERR_TYPE_MISMATCH | |
OCT_ERR_RECORD_NAME_MISMATCH | |
OCT_ERR_ATTRIBUTE_MISMATCH |
errval_t oct_set | ( | const char * | query, |
... | |||
) |
Sets a record.
query | The record to set. |
... | Additional arguments to format the query using vsprintf. |
SYS_ERR_OK | |
OCT_ERR_NO_RECORD_NAME | |
OCT_ERR_PARSER_FAIL | |
OCT_ERR_ENGINE_FAIL |
errval_t oct_set_get | ( | oct_mode_t | mode, |
char ** | record, | ||
const char * | query, | ||
... | |||
) |
Sets a record and returns and in case of no error returns it to the client.
Additonally the mode how a record is set can be specified.
mode | A combination of mode bits (see getset.h). | |
[out] | record | The new record. |
[in] | query | The record to set. |
... | Additional arguments to format the query using vsprintf. |
SYS_ERR_OK | |
OCT_ERR_NO_RECORD_NAME | |
OCT_ERR_PARSER_FAIL | |
OCT_ERR_ENGINE_FAIL | TODO maybe remove this function completely and let all use rpc call for set directly if they want to a non-trivial set? |
errval_t oct_set_with_idcap | ( | struct capref | idcap, |
const char * | attributes, | ||
... | |||
) |
Sets a record using the ID capability as the name/key of the record.
idcap | ID capability used as the name/key of the record. |
attributes | Attributes of the record. |
... | Additional arguments to format the attributes using vsprintf. |
SYS_ERR_OK | |
OCT_ERR_NO_RECORD_NAME | |
OCT_ERR_PARSER_FAIL | |
OCT_ERR_ENGINE_FAIL |
errval_t oct_wait_for | ( | char ** | record, |
const char * | query, | ||
... | |||
) |
Waits until a given record exists.
record | Record that matched the query, callee has to free this. |
query | Format of record to wait for. |
... | Additional arguments to format query. |
SYS_ERR_OK |