ESP SDK C API
Entities/Objects | Functions
Uri

Overview

EspUri objects are used to access or refer to a cluster and projects running in a cluster. From SDK's point of view a cluster is identified by a list of host/port values.

Entities/Objects

typedef struct EspUri EspUri

Enumeration Types

enum ESP_URI_T

An EspUri object is used to refer to all cluster based components that the SDK can access.

Enumerator:
UNDEFINED_URI 
SERVER_URI 

URI that refers to running server/cluster

WORKSPACE_URI 

URI that refers to a workspace in a cluster

PROJECT_URI 

URI that refers to a project in a cluster

STREAM_URI 

URI that refers to a stream in a project

Functions

ESPAPICALL EspUriesp_uri_create_string (const char *const uri_string, EspError *error)
ESPAPICALL EspUriesp_uri_create (ESP_URI_T type, EspError *error)
ESPAPICALL int32_t esp_uri_add_manager (EspUri *uri, const char *manager_host, const int32_t manager_port, EspError *error)
ESPAPICALL int32_t esp_uri_add_manager_string (EspUri *uri, const char *manager_string, EspError *error)
ESPAPICALL int32_t esp_uri_set_ssl (EspUri *uri, const int32_t ssl, EspError *error)
ESPAPICALL int32_t esp_uri_set_server (EspUri *uri, const char *server, EspError *error)
ESPAPICALL int32_t esp_uri_set_workspace (EspUri *uri, const char *workspace, EspError *error)
ESPAPICALL int32_t esp_uri_set_project (EspUri *uri, const char *project, EspError *error)
ESPAPICALL int32_t esp_uri_set_stream (EspUri *uri, const char *stream, EspError *error)
ESPAPICALL int32_t esp_uri_free (EspUri *uri, EspError *error)
ESPAPICALL int32_t esp_uri_get_type (const EspUri *uri, ESP_URI_T *type, EspError *error)
ESPAPICALL int32_t esp_uri_get_server (const EspUri *uri, char *server, int32_t *size, EspError *error)
ESPAPICALL int32_t esp_uri_get_managers (const EspUri *uri, EspList *managers, EspError *error)
ESPAPICALL int32_t esp_uri_get_workspace (const EspUri *uri, char *workspace, int32_t *size, EspError *error)
ESPAPICALL int32_t esp_uri_get_project (const EspUri *uri, char *project, int32_t *size, EspError *error)
ESPAPICALL int32_t esp_uri_get_stream (const EspUri *uri, char *stream, int32_t *size, EspError *error)
ESPAPICALL int32_t esp_uri_get_string (const EspUri *uri, char *uri_string, int32_t *size, EspError *error)

Function Documentation

ESPAPICALL int32_t esp_uri_add_manager ( EspUri uri,
const char *  manager_host,
const int32_t  manager_port,
EspError *  error 
)

Adds the connection details (host and port) for a manager.

Returns:
0 on success.
Parameters:
uriEspUri to modify
manager_hosthost where manager is running
manager_portport number for manager xmlrpc
ESPAPICALL int32_t esp_uri_add_manager_string ( EspUri uri,
const char *  manager_string,
EspError *  error 
)

Adds the connection details for a manager as a preformatted string "[http[s]://]host:port" If multiple manager URIs are added and one of them has an https protocol, all manager connections are assumed to be https.

Returns:
0 on success.
Parameters:
uriEspUri to modify
manager_stringManager connection string using http/https protocol specification
ESPAPICALL EspUri* esp_uri_create ( ESP_URI_T  type,
EspError *  error 
)

Create an emtpy uri object of type 'type'. The URI object should be freed using esp_uri_free().

Returns:
an unitialized URI object or NULL in case of error.
Parameters:
typeThe type of uri to create.
ESPAPICALL EspUri* esp_uri_create_string ( const char *const  uri_string,
EspError *  error 
)

Creates an EspUri object from a string. SDK parses the string and determines the type of EspUri to create. The new EspUri * object should be freed using esp_uri_free(). The string needs to conform to the following format

esp[s]://host1:port1;host2:port2[/workspace/project/stream] 

where

  • hostN:portN are the list of known cluster managers
  • workspace is the workspace being connected to
  • project is the project in the above workspace
  • stream is the stream in the project
Returns:
NULL in case of error
ESPAPICALL int32_t esp_uri_free ( EspUri uri,
EspError *  error 
)

Frees the resources used by the EspUri object.

ESPAPICALL int32_t esp_uri_get_managers ( const EspUri uri,
EspList managers,
EspError *  error 
)

Query for the list of managers defined in the EspUri.

Returns:
0 on success.
Parameters:
uriEspUri to query
ESPAPICALL int32_t esp_uri_get_project ( const EspUri uri,
char *  project,
int32_t *  size,
EspError *  error 
)

Query for the project name defined in the EspUri.

Returns:
0 on success.
Parameters:
uriEspUri to query
projectBuffer to contain the project name
sizeon entry size of the buffer being passed. On successful return size of the formatted string
ESPAPICALL int32_t esp_uri_get_server ( const EspUri uri,
char *  server,
int32_t *  size,
EspError *  error 
)

Query the server name in the EspUri.

Returns:
0 on success.
Parameters:
uriEspUri to query
serverPointer to a char * that will be filled in successful on return
sizeon entry size of the buffer being passed. On successful return size of the formatted string
ESPAPICALL int32_t esp_uri_get_stream ( const EspUri uri,
char *  stream,
int32_t *  size,
EspError *  error 
)
Parameters:
uriEspUri to query
streamBuffer to contain the stream name
sizeon entry size of the buffer being passed. On successful return size of the formatted string
ESPAPICALL int32_t esp_uri_get_string ( const EspUri uri,
char *  uri_string,
int32_t *  size,
EspError *  error 
)

Returns the formatted representation for the EspUri.

Returns:
0 on success.
Parameters:
uriEspUri to query
uri_stringbuffer to contain the formatted string
sizeon entry, the size of the buffer being passed. On successful return, the size of the formatted string
ESPAPICALL int32_t esp_uri_get_type ( const EspUri uri,
ESP_URI_T type,
EspError *  error 
)

Query the type of this EspUri.

Returns:
0 on success.
Parameters:
uriEspUri to query
typePointer to an ESP_URI_T enum that will contain the type on return
ESPAPICALL int32_t esp_uri_get_workspace ( const EspUri uri,
char *  workspace,
int32_t *  size,
EspError *  error 
)
Returns:
0 on success.
Parameters:
uriEspUri to query
workspaceBuffer to contain the workspace name
sizeon entry size of the buffer being passed. On successful return size of the formatted string
ESPAPICALL int32_t esp_uri_set_project ( EspUri uri,
const char *  project,
EspError *  error 
)

Set the name of project component. Will overwrite existing name if any.

Returns:
0 on success.
ESPAPICALL int32_t esp_uri_set_server ( EspUri uri,
const char *  server,
EspError *  error 
)

Set the name of the server component. Will overwrite existing name if any. A server specification string consists of semicolon delimited managers specs (for example, host1:port1;host2:port2).

Returns:
0 on success.
ESPAPICALL int32_t esp_uri_set_ssl ( EspUri uri,
const int32_t  ssl,
EspError *  error 
)

Sets all manager connections in this EspUri to use or not use SSL. Note that SSL can be turned on by explicitly specifying https protocol in the add_manager call. In that case, the last change made before the EspUri object is used in the SDK will be in effect.

Returns:
0 on success.
Parameters:
sslnon-zero to enable SSL
ESPAPICALL int32_t esp_uri_set_stream ( EspUri uri,
const char *  stream,
EspError *  error 
)

Set the name of stream component. Will overwrite existing name if any.

Returns:
0 on success.
ESPAPICALL int32_t esp_uri_set_workspace ( EspUri uri,
const char *  workspace,
EspError *  error 
)

Set the name of workspace component. Will overwrite existing name if any.

Returns:
0 on success.
 All Classes Variables