Commit 54a899e3 authored by unknown's avatar unknown

updated EventApi documentation

parent 11a2a356
...@@ -17,9 +17,10 @@ ...@@ -17,9 +17,10 @@
/** /**
@mainpage NDB API Programmers' Guide @mainpage NDB API Programmers' Guide
This guide assumes a basic familiarity with MySQL Cluster concepts. This guide assumes a basic familiarity with MySQL Cluster concepts found
Some of the fundamental ones are described in section @ref secConcepts. on http://dev.mysql.com/doc/mysql/en/NDBCluster.html .
Some of the fundamental ones are also described in section @ref secConcepts.
The <em>NDB API</em> is a MySQL Cluster application interface The <em>NDB API</em> is a MySQL Cluster application interface
that implements transactions. that implements transactions.
The NDB API consists of the following fundamental classes: The NDB API consists of the following fundamental classes:
...@@ -34,6 +35,10 @@ ...@@ -34,6 +35,10 @@
- NdbRecAttr represents an attribute value - NdbRecAttr represents an attribute value
- NdbDictionary represents meta information about tables and attributes. - NdbDictionary represents meta information about tables and attributes.
- NdbError contains the specification for an error. - NdbError contains the specification for an error.
It is also possible to receive "events" on changed data in the database.
This is done through the NdbEventOperation class.
There are also some auxiliary classes. There are also some auxiliary classes.
The main structure of an application program is as follows: The main structure of an application program is as follows:
...@@ -515,7 +520,7 @@ ...@@ -515,7 +520,7 @@
/** /**
@page secConcepts NDB Cluster Concepts @page secConcepts NDB Cluster Concepts
The <em>NDB Kernel</em> is the collection of database (DB) nodes The <em>NDB Kernel</em> is the collection of storage nodes
belonging to an NDB Cluster. belonging to an NDB Cluster.
The application programmer can for most purposes view the The application programmer can for most purposes view the
set of all DB nodes as one entity. set of all DB nodes as one entity.
...@@ -1160,7 +1165,7 @@ public: ...@@ -1160,7 +1165,7 @@ public:
* @param eventName * @param eventName
* unique identifier of the event * unique identifier of the event
* @param bufferLength * @param bufferLength
* buffer size for storing event data * circular buffer size for storing event data
* *
* @return Object representing an event, NULL on failure * @return Object representing an event, NULL on failure
*/ */
......
...@@ -38,21 +38,15 @@ class NdbEventOperationImpl; ...@@ -38,21 +38,15 @@ class NdbEventOperationImpl;
* @brief Class of operations for getting change events from database. * @brief Class of operations for getting change events from database.
* *
* An NdbEventOperation object is instantiated by * An NdbEventOperation object is instantiated by
* NdbEventOperation *Ndb::createEventOperation(const char *eventName, * Ndb::createEventOperation
* int bufferLength)
* *
* Prior to that an event must have been created in the Database through * Prior to that an event must have been created in the Database through
* int NdbDictionary::createEvent(NdbDictionary::Event) * NdbDictionary::createEvent
* *
* bufferLength indicates size of circular buffer to store event info as * The instance is removed by Ndb::dropEventOperation
* they occur.
*
* The instance is removed by Ndb::dropEventOperation(NdbEventOperation*)
* *
* For more info see: * For more info see:
* ndbapi_example5.cpp * @ref ndbapi_example5.cpp
* Ndb.hpp
* NdbDictionary.hpp
* *
* Known limitations: * Known limitations:
* *
...@@ -72,18 +66,15 @@ class NdbEventOperationImpl; ...@@ -72,18 +66,15 @@ class NdbEventOperationImpl;
* Today all events INSERT/DELETE/UPDATE and all changed attributes are * Today all events INSERT/DELETE/UPDATE and all changed attributes are
* sent to the API, even if only specific attributes have been specified. * sent to the API, even if only specific attributes have been specified.
* These are however hidden from the user and only relevant data is shown * These are however hidden from the user and only relevant data is shown
* after next(). However false exits from pollEvents() may occur and thus * after next().
* the subsequent next() will return zero, since there was no available * However false exits from Ndb::pollEvents() may occur and thus
* data. Just do pollEvents() again. Will be fixed in later versions. * the subsequent next() will return zero,
* since there was no available data. Just do Ndb::pollEvents() again.
* *
* Event code does not check table schema version. Make sure to drop events * Event code does not check table schema version. Make sure to drop events
* after table is dropped. Will be fixed in later * after table is dropped. Will be fixed in later
* versions. * versions.
* *
* On a replicated system one will receive each event 2 times, one for each
* replica. If a node fails events will not be received twice anymore
* for data in corresponding fragment. Will be optimized in later versions.
*
* If a node failure has occured not all events will be recieved * If a node failure has occured not all events will be recieved
* anymore. Drop NdbEventOperation and Create again after nodes are up * anymore. Drop NdbEventOperation and Create again after nodes are up
* again. Will be fixed in later versions. * again. Will be fixed in later versions.
...@@ -93,7 +84,7 @@ class NdbEventOperationImpl; ...@@ -93,7 +84,7 @@ class NdbEventOperationImpl;
* *
* Known bugs: * Known bugs:
* *
* None, except if we can call some of the "isses" above bugs * None, except if we can call some of the "issues" above bugs
* *
* Useful API programs: * Useful API programs:
* *
...@@ -103,8 +94,10 @@ class NdbEventOperationImpl; ...@@ -103,8 +94,10 @@ class NdbEventOperationImpl;
*/ */
class NdbEventOperation { class NdbEventOperation {
public: public:
/**
* Retrieve current state of the NdbEventOperation object
*/
enum State {CREATED,EXECUTING,ERROR}; enum State {CREATED,EXECUTING,ERROR};
State getState(); State getState();
/** /**
...@@ -163,7 +156,7 @@ public: ...@@ -163,7 +156,7 @@ public:
/** /**
* Retrieves event resultset if available, inserted into the NdbRecAttrs * Retrieves event resultset if available, inserted into the NdbRecAttrs
* specified in getValue() and getPreValue(). To avoid polling for * specified in getValue() and getPreValue(). To avoid polling for
* a resultset, one can use Ndb::pollEvents(int millisecond_timeout) * a resultset, one can use Ndb::pollEvents
* which will wait on a mutex until an event occurs or the specified * which will wait on a mutex until an event occurs or the specified
* timeout occurs. * timeout occurs.
* *
...@@ -171,6 +164,8 @@ public: ...@@ -171,6 +164,8 @@ public:
* of available events. By sending pOverRun one may query for buffer * of available events. By sending pOverRun one may query for buffer
* overflow and *pOverRun will indicate the number of events that have * overflow and *pOverRun will indicate the number of events that have
* overwritten. * overwritten.
*
* @return number of available events, -1 on failure
*/ */
int next(int *pOverRun=0); int next(int *pOverRun=0);
...@@ -182,25 +177,34 @@ public: ...@@ -182,25 +177,34 @@ public:
/** /**
* Query for occured event type. * Query for occured event type.
* NdbDictionary::Event::{TE_INSERT,TE_UPDATE,TE_DELETE} *
* Only valid after next() has returned value >= 0 * @note Only valid after next() has been called and returned value >= 0
*
* @return type of event
*/ */
NdbDictionary::Event::TableEvent getEventType(); NdbDictionary::Event::TableEvent getEventType();
/** /**
* Retrieve the GCI of the latest retrieved event
* *
* @return GCI number
*/ */
Uint32 getGCI(); Uint32 getGCI();
/** /**
* Retrieve the complete GCI in the cluster (not necessarily
* associated with an event)
* *
* @return GCI number
*/ */
Uint32 getLatestGCI(); Uint32 getLatestGCI();
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
/* /*
* *
*/ */
void print(); void print();
#endif
private: private:
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment