CppCrate 0.1
Public Member Functions | List of all members
CppCrate::Node Class Reference

Public Member Functions

 Node (const std::string &url="http://localhost:4200")
 
 Node (const std::string &url, const std::string &user, const std::string &password)
 
const std::string & password () const
 
void setPassword (const std::string &password)
 
void setUrl (const std::string &url)
 
void setUser (const std::string &user)
 
const std::string & url () const
 
std::string url (const std::string &path) const
 
const std::string & user () const
 

Detailed Description

The class Node encapsulates the information needed to connect to a Crate cluster node. If a user and password is set CURL picks the best suitable authentication automatically (CURLAUTH_ANY).

The setup for a node that is password protected could – for example – look like:

Node node;
node.setUrl("http://localhost:4200");
node.setUser("Hobbes");
node.setPassword("magic_tiger");

Constructor & Destructor Documentation

◆ Node() [1/2]

CppCrate::Node::Node ( const std::string &  url = "http://localhost:4200")
explicit

Constructs a node that connects to the URL url.

◆ Node() [2/2]

CppCrate::Node::Node ( const std::string &  url,
const std::string &  user,
const std::string &  password 
)

Constructs a node that connects to the URL url with the credentials user and password.

Member Function Documentation

◆ password()

const std::string & CppCrate::Node::password ( ) const

Returns the password used to connect to the node.

◆ setPassword()

void CppCrate::Node::setPassword ( const std::string &  password)

Sets the password used to connect to the node to password.

◆ setUrl()

void CppCrate::Node::setUrl ( const std::string &  url)

Sets the URL used to connect to the node to url.

◆ setUser()

void CppCrate::Node::setUser ( const std::string &  user)

Sets the user used to connect to the node to user.

◆ url() [1/2]

const std::string & CppCrate::Node::url ( ) const

Returns the node's URL.

◆ url() [2/2]

std::string CppCrate::Node::url ( const std::string &  path) const

Returns the node's URL extended by path.

Node node("http://localhost:4200");
node.url("/_sql"); // http://localhost:4200/_sql

◆ user()

const std::string & CppCrate::Node::user ( ) const

Returns the user used to connect to the node.