NdbDictionary::Index Class Reference

Represents an index in an NDB Cluster. More...

#include <NdbDictionary.hpp>

Inheritance diagram for NdbDictionary::Index:

NdbDictionary::Object

List of all members.

Public Types

enum  Status {
  New, Changed, Retrieved, Invalid,
  Altered
}
enum  State {
  StateUndefined = 0, StateOffline = 1, StateBuilding = 2, StateDropping = 3,
  StateOnline = 4, StateBackup = 5, StateBroken = 9
}
enum  Store { StoreUndefined = 0, StoreNotLogged = 1, StorePermanent = 2 }
enum  FragmentType {
  FragUndefined = 0, FragSingle = 1, FragAllSmall = 2, FragAllMedium = 3,
  FragAllLarge = 4, DistrKeyHash = 5, DistrKeyLin = 6, UserDefined = 7,
  HashMapPartition = 9
}

Public Member Functions

Index creation
These methods should normally not be used in an application as the result will not be visible from the MySQL Server

 Index (const char *name="")
virtual ~Index ()
int setName (const char *name)
int setTable (const char *name)
int addColumn (const Column &c)
int addColumnName (const char *name)
int addIndexColumn (const char *name)
int addColumnNames (unsigned noOfNames, const char **names)
int addIndexColumns (int noOfNames, const char **names)
void setType (Type type)
void setLogging (bool enable)
void setStoredIndex (bool x)
bool getStoredIndex () const
bool getTemporary () const
void setTemporary (bool)

Private Member Functions

 Index (NdbIndexImpl &)

Private Attributes

class NdbIndexImpl & m_impl

Getting Index properties

enum  Type { Undefined = 0, UniqueHashIndex = 3, OrderedIndex = 6 }
const char * getName () const
const char * getTable () const
unsigned getNoOfColumns () const
int getNoOfIndexColumns () const
const ColumngetColumn (unsigned no) const
const char * getIndexColumn (int no) const
Type getType () const
bool getLogging () const
virtual Object::Status getObjectStatus () const
virtual int getObjectVersion () const
virtual int getObjectId () const
const NdbRecord * getDefaultRecord () const


Detailed Description

Represents an index in an NDB Cluster.

Member Enumeration Documentation

Type of fragmentation.

This parameter specifies how data in the table or index will be distributed among the db nodes in the cluster.
The bigger the table the more number of fragments should be used. Note that all replicas count as same "fragment".
For a table, default is FragAllMedium. For a unique hash index, default is taken from underlying table and cannot currently be changed.

Enumerator:
FragUndefined  Fragmentation type undefined or default.
FragSingle  Only one fragment.
FragAllSmall  One fragment per node, default.
FragAllMedium  two fragments per node
FragAllLarge  Four fragments per node.
DistrKeyHash 
DistrKeyLin 
UserDefined 
HashMapPartition 

enum NdbDictionary::Object::State [inherited]

Object state

Enumerator:
StateUndefined  Undefined.
StateOffline  Offline, not usable.
StateBuilding  Building, not yet usable.
StateDropping  Offlining or dropping, not usable.
StateOnline  Online, usable.
StateBackup  Online, being backuped, usable.
StateBroken  Broken, should be dropped and re-created.

Status of object

Enumerator:
New  The object only exist in memory and has not been created in the NDB Kernel
Changed  The object has been modified in memory and has to be commited in NDB Kernel for changes to take effect
Retrieved  The object exist and has been read into main memory from NDB Kernel
Invalid  The object has been invalidated and should not be used
Altered  Table has been altered in NDB kernel but is still valid for usage

enum NdbDictionary::Object::Store [inherited]

Object store

Enumerator:
StoreUndefined  Undefined.
StoreNotLogged  Object or data deleted on system restart.
StorePermanent  Permanent. logged to disk.

Represents type of index

Enumerator:
Undefined  Undefined object type (initial value).
UniqueHashIndex  Unique un-ordered hash index (only one currently supported)
OrderedIndex  Non-unique ordered index.

Reimplemented from NdbDictionary::Object.


Constructor & Destructor Documentation

NdbDictionary::Index::Index ( const char *  name = ""  ) 

Constructor

Parameters:
name Name of index

virtual NdbDictionary::Index::~Index (  )  [virtual]

NdbDictionary::Index::Index ( NdbIndexImpl &   )  [private]


Member Function Documentation

int NdbDictionary::Index::addColumn ( const Column c  ) 

Add a column to the index definition Note that the order of columns will be in the order they are added (only matters for ordered indexes).

int NdbDictionary::Index::addColumnName ( const char *  name  ) 

Add a column name to the index definition Note that the order of indexes will be in the order they are added (only matters for ordered indexes).

int NdbDictionary::Index::addColumnNames ( unsigned  noOfNames,
const char **  names 
)

Add several column names to the index definition Note that the order of indexes will be in the order they are added (only matters for ordered indexes).

int NdbDictionary::Index::addIndexColumn ( const char *  name  ) 

Add a column name to the index definition Note that the order of indexes will be in the order they are added (only matters for ordered indexes). Depricated, use addColumnName instead.

int NdbDictionary::Index::addIndexColumns ( int  noOfNames,
const char **  names 
)

Add several column names to the index definition Note that the order of indexes will be in the order they are added (only matters for ordered indexes). Depricated, use addColumnNames instead.

const Column* NdbDictionary::Index::getColumn ( unsigned  no  )  const

Get a specific column in the index

const NdbRecord* NdbDictionary::Index::getDefaultRecord (  )  const

Get default NdbRecord object for this index This NdbRecord object becomes invalid at the same time as the index object does - when the ndb_cluster_connection is closed.

const char* NdbDictionary::Index::getIndexColumn ( int  no  )  const

Get a specific column name in the index Depricated, use getColumn instead.

bool NdbDictionary::Index::getLogging (  )  const

Check if index is set to be stored on disk

Returns:
if true then logging is enabled
Note:
Non-logged indexes are rebuilt at system restart.

Ordered index does not currently support logging.

const char* NdbDictionary::Index::getName (  )  const

Get the name of an index

unsigned NdbDictionary::Index::getNoOfColumns (  )  const

Get the number of columns in the index

int NdbDictionary::Index::getNoOfIndexColumns (  )  const

Get the number of columns in the index Depricated, use getNoOfColumns instead.

virtual int NdbDictionary::Index::getObjectId (  )  const [virtual]

Get object id

Implements NdbDictionary::Object.

virtual Object::Status NdbDictionary::Index::getObjectStatus (  )  const [virtual]

Get object status

Implements NdbDictionary::Object.

virtual int NdbDictionary::Index::getObjectVersion (  )  const [virtual]

Get object version

Implements NdbDictionary::Object.

bool NdbDictionary::Index::getStoredIndex (  )  const [inline]

const char* NdbDictionary::Index::getTable (  )  const

Get the name of the underlying table being indexed

bool NdbDictionary::Index::getTemporary (  )  const

Type NdbDictionary::Index::getType (  )  const

Get index type of the index

void NdbDictionary::Index::setLogging ( bool  enable  ) 

Enable/Disable index storage on disk

Parameters:
enable If enable is set to true, then logging becomes enabled
See also:
NdbDictionary::Index::getLogging

int NdbDictionary::Index::setName ( const char *  name  ) 

Set the name of an index

void NdbDictionary::Index::setStoredIndex ( bool  x  )  [inline]

int NdbDictionary::Index::setTable ( const char *  name  ) 

Define the name of the table to be indexed

void NdbDictionary::Index::setTemporary ( bool   ) 

void NdbDictionary::Index::setType ( Type  type  ) 

Set index type of the index


Member Data Documentation

class NdbIndexImpl& NdbDictionary::Index::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.