Barrelfish
Functions
getset.c File Reference

Get/Set client API implementation. More...

Functions

errval_t oct_get_names (char ***names, size_t *len, const char *query,...)
 Retrieve all record names matching a given query. More...
 
errval_t oct_get (char **data, const char *query,...)
 Gets one record matching the given query. More...
 
errval_t oct_set (const char *query,...)
 Sets a record. More...
 
errval_t oct_mset (oct_mode_t mode, const char *query,...)
 Sets a record. More...
 
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. More...
 
errval_t oct_get_with_idcap (char **data, struct capref idcap)
 Gets one record using the ID capability as the key/name. More...
 
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. More...
 
errval_t oct_del (const char *query,...)
 Deletes all records matching the given query. More...
 
errval_t oct_exists (const char *query,...)
 Checks if a result for a given query exists. More...
 
errval_t oct_wait_for (char **record, const char *query,...)
 Waits until a given record exists. More...
 

Detailed Description

Get/Set client API implementation.

This file provides convenience functions to interface with the octopus.if RPC calls.

Function Documentation

errval_t oct_del ( const char *  query,
  ... 
)

Deletes all records matching the given query.

Parameters
querySpecifies the record(s) to be deleted.
...Additional arguments to format the query using vsprintf.
Return values
SYS_ERR_OK
OCT_ERR_NO_RECORD
OCT_ERR_NO_RECORD_NAME
OCT_ERR_ENGINE_FAIL
OCT_ERR_PARSER_FAILTODO: 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.

Parameters
queryResults are searched based on the query.
...Additional arguments to format the query using vsprintf.
Return values
SYS_ERR_OK
OCT_ERR_NO_RECORD
OCT_ERR_PARSER_FAIL
OCT_ERR_ENGINE_FAIL
errval_t oct_get ( char **  data,
const char *  query,
  ... 
)

Gets one record matching the given query.

Parameters
[out]dataRecord returned by the server.
[in]queryThe query sent to the server.
...Additional arguments to format the query using vsprintf.
Return values
SYS_ERR_OK
OCT_ERR_NO_RECORD
OCT_ERR_AMBIGOUS_QUERYTODO!
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.

Parameters
[out]namesNames 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]sizeNumber of records matching the query. 0 in case of error.
[in]queryQuery sent to the server
...Parameters used to build query with help of vsprintf.
Return values
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.

Parameters
[out]dataRecord returned by the server.
[in]idcapID capability used as the key/name of the record.
Return values
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.

Parameters
queryThe record to set.
modeA combination of mode bits (see getset.h).
...Additional arguments to format the query using vsprintf.
Return values
SYS_ERR_OK
OCT_ERR_NO_RECORD_NAME
OCT_ERR_PARSER_FAIL
OCT_ERR_ENGINE_FAIL
errval_t oct_set ( const char *  query,
  ... 
)

Sets a record.

Parameters
queryThe record to set.
...Additional arguments to format the query using vsprintf.
Return values
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.

Parameters
modeA combination of mode bits (see getset.h).
[out]recordThe new record.
[in]queryThe record to set.
...Additional arguments to format the query using vsprintf.
Return values
SYS_ERR_OK
OCT_ERR_NO_RECORD_NAME
OCT_ERR_PARSER_FAIL
OCT_ERR_ENGINE_FAILTODO 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.

Parameters
idcapID capability used as the name/key of the record.
attributesAttributes of the record.
...Additional arguments to format the attributes using vsprintf.
Return values
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.

Parameters
recordRecord that matched the query, callee has to free this.
queryFormat of record to wait for.
...Additional arguments to format query.
Note
This call blocks on the octopus RPC waitset if the record is not there yet.
Return values
SYS_ERR_OK