DVIDConnection

class DVIDConnection

Creates a libcurl connection and provides utilities for transferring data between this library and DVID. Each service will call DVIDConnection independently and does not need to be accessed very often by the end-user. This class uses a static variable to set the curl context and also sets a curl connection.

Warning

It is currently not possible to use a single DVIDConnection for multiple threads. Users should instantiate multiple services to access DVID rather than reusing the same one. This problem will be fixed when the curl connection is given thread-level scope as available in C++11.

get_addr((DVIDConnection)arg1) → str :

Get the address for the DVID connection.

get_uri_root((DVIDConnection)arg1) → str :

Get the prefix for all DVID API calls

make_head_request((DVIDConnection)arg1, (str)endpoint) → int :

Simple HEAD requests to DVID. An exception is generated if curl cannot properly connect to the URL.

Parameters:endpoint – endpoint where request is performed
Returns:html status code
make_request((DVIDConnection)connection, (str)endpoint, (ConnectionMethod)method[, (object)payload=None[, (int)timeout=120[, (long)datasize=1]]]) → tuple :

Main helper function retrieving data from DVID. The function performs the action specified in method. An exception is generated if curl cannot properly connect to the URL.

Parameters:
  • endpoint – endpoint where request is performed
  • methodlibdvid.ConnectionMethod, (HEAD, GET, POST, PUT, DELETE)
  • payload – binary data containing data to be posted
  • timeout – timeout for the request (seconds)
  • datasize – estimate payload if GET (only useful if there is a resource manager)
Returns:

tuple: (status_code, results (bytes), err_msg)

ConnectionMethod

class ConnectionMethod

Enum for Http Verbs.

Members:

  • HEAD
  • GET
  • POST
  • PUT
  • DELETE