Ndb_cluster_connection Class Reference

Represents a connection to a cluster of storage nodes. More...

#include <ndb_cluster_connection.hpp>

List of all members.

Public Member Functions

 Ndb_cluster_connection (const char *connectstring=0)
 ~Ndb_cluster_connection ()
void set_name (const char *name)
int set_timeout (int timeout_ms)
int connect (int no_retries=0, int retry_delay_in_seconds=1, int verbose=0)
int wait_until_ready (int timeout_for_first_alive, int timeout_after_first_alive)
void lock_ndb_objects ()
void unlock_ndb_objects ()
const Ndbget_next_ndb_object (const Ndb *p)
int get_latest_error () const
const char * get_latest_error_msg () const
void set_auto_reconnect (int value)
int get_auto_reconnect () const

Private Member Functions

 Ndb_cluster_connection (Ndb_cluster_connection_impl &)
 Ndb_cluster_connection (const Ndb_cluster_connection &)
Ndb_cluster_connectionoperator= (const Ndb_cluster_connection &)

Private Attributes

class Ndb_cluster_connection_impl & m_impl

Friends

class Ndb
class NdbImpl
class Ndb_cluster_connection_impl
class SignalSender


Detailed Description

Represents a connection to a cluster of storage nodes.

Any NDB application program should begin with the creation of a single Ndb_cluster_connection object, and should make use of one and only one Ndb_cluster_connection. The application connects to a cluster management server when this object's connect() method is called. By using the wait_until_ready() method it is possible to wait for the connection to reach one or more storage nodes.


Constructor & Destructor Documentation

Ndb_cluster_connection::Ndb_cluster_connection ( const char *  connectstring = 0  ) 

Create a connection to a cluster of storage nodes

Parameters:
connectstring The connectstring for where to find the management server

Ndb_cluster_connection::~Ndb_cluster_connection (  ) 

Ndb_cluster_connection::Ndb_cluster_connection ( Ndb_cluster_connection_impl &   )  [private]

Ndb_cluster_connection::Ndb_cluster_connection ( const Ndb_cluster_connection  )  [private]


Member Function Documentation

int Ndb_cluster_connection::connect ( int  no_retries = 0,
int  retry_delay_in_seconds = 1,
int  verbose = 0 
)

Connect to a cluster management server

Parameters:
no_retries specifies the number of retries to attempt in the event of connection failure; a negative value will result in the attempt to connect being repeated indefinitely
retry_delay_in_seconds specifies how often retries should be performed
verbose specifies if the method should print a report of its progess
Returns:
0 = success, 1 = recoverable error, -1 = non-recoverable error

int Ndb_cluster_connection::get_auto_reconnect (  )  const

int Ndb_cluster_connection::get_latest_error (  )  const

const char* Ndb_cluster_connection::get_latest_error_msg (  )  const

const Ndb* Ndb_cluster_connection::get_next_ndb_object ( const Ndb p  ) 

Iterator of ndb-objects

Parameters:
p Pointer to last returned ndb-object NULL - returns first object
Note:
lock_ndb_objects should be used before using this function and unlock_ndb_objects should be used after

void Ndb_cluster_connection::lock_ndb_objects (  ) 

Lock creation of ndb-objects Needed to iterate over created ndb objects

Ndb_cluster_connection& Ndb_cluster_connection::operator= ( const Ndb_cluster_connection  )  [private]

void Ndb_cluster_connection::set_auto_reconnect ( int  value  ) 

Enable/disable auto-reconnect

Parameters:
value 0 = false, 1 = true

void Ndb_cluster_connection::set_name ( const char *  name  ) 

Set a name on the connection, which will be reported in cluster log

Parameters:
name 

int Ndb_cluster_connection::set_timeout ( int  timeout_ms  ) 

Set timeout

Used as a timeout when talking to the management server, helps limit the amount of time that we may block when connecting

Basically just calls ndb_mgm_set_timeout(h,ms).

The default is 30 seconds.

Parameters:
timeout_ms millisecond timeout. As with ndb_mgm_set_timeout, only increments of 1000 are really supported, with not to much gaurentees about calls completing in any hard amount of time.
Returns:
0 on success

void Ndb_cluster_connection::unlock_ndb_objects (  ) 

Unlock creation of ndb-objects

int Ndb_cluster_connection::wait_until_ready ( int  timeout_for_first_alive,
int  timeout_after_first_alive 
)

Wait until the requested connection with one or more storage nodes is successful

Parameters:
timeout_for_first_alive Number of seconds to wait until first live node is detected
timeout_after_first_alive Number of seconds to wait after first live node is detected
Returns:
= 0 all nodes live, > 0 at least one node live, < 0 error


Friends And Related Function Documentation

friend class Ndb [friend]

friend class Ndb_cluster_connection_impl [friend]

friend class NdbImpl [friend]

friend class SignalSender [friend]


Member Data Documentation

class Ndb_cluster_connection_impl& Ndb_cluster_connection::m_impl [private]


The documentation for this class was generated from the following file:

MySQL Cluster Database Blog

Based on MySQL Cluster 7.0.10.

This page is for information only and is not maintained by MySQL or Sun Microsystems - use at your own risk. For an upto date view of the API refer to the header files included with your MySQL Cluster distribution or check the MySQL Cluster API Developer Guide.