MySQL NDB Cluster API Developer Guide

2.3.2 The Datafile Class

This section provides information about the Datafile class, which models an NDB Cluster data file.

Datafile Class Overview

Parent class

Object

Child classes

None

Description

The Datafile class models an NDB Cluster data file, which is used to store Disk Data table and column data.

Only unindexed column data can be stored on disk. Indexes and indexed columns are stored in memory.

Methods

The following table lists the public methods of this class and the purpose or use of each method:

Table 2.10 Datafile class methods and descriptions

Name Description
Datafile() Class constructor
~Datafile() Destructor
getFileNo() Removed in NDB 7.5.0 (Bug #47960, Bug #11756088)
getFree() Gets the amount of free space in the data file
getNode() Removed in NDB 7.5.0 (Bug #47960, Bug #11756088)
getObjectId() Gets the data file's object ID
getObjectStatus() Gets the data file's object status
getObjectVersion() Gets the data file's object version
getPath() Gets the file system path to the data file
getSize() Gets the size of the data file
getTablespace() Gets the name of the tablespace to which the data file belongs
getTablespaceId() Gets the ID of the tablespace to which the data file belongs
setNode() Removed in NDB 7.5.0 (Bug #47960, Bug #11756088)
setPath() Sets the name and location of the data file on the file system
setSize() Sets the data file's size
setTablespace() Sets the tablespace to which the data file belongs

Types

The Datafile class defines no public types.

Datafile Class Constructor

Description

This method creates a new instance of Datafile, or a copy of an existing one.

Signature

To create a new instance:

Datafile
    (
      void
    )

To create a copy of an existing Datafile instance:

Datafile
    (
      const Datafile& datafile
    )
Parameters

New instance: None. Copy constructor: a reference to the Datafile instance to be copied.

Return value

A Datafile object.

Datafile::getFileNo()

Description

This method did not work as intended, and was removed in NDB 7.5.0 (Bug #47960, Bug #11756088).

Signature
Uint32 getFileNo
    (
      void
    ) const
Parameters

None.

Return value

The file number, as an unsigned 32-bit integer.

Datafile::getFree()

Description

This method gets the free space available in the data file.

Signature
Uint64 getFree
    (
      void
    ) const
Parameters

None.

Return value

The number of bytes free in the data file, as an unsigned 64-bit integer.

Datafile::getNode()

Description

This method did not work as intended, and was removed in NDB 7.5.0 (Bug #47960, Bug #11756088).

Signature
Uint32 getNode
    (
      void
    ) const
Parameters

None.

Return value

The node ID as an unsigned 32-bit integer.

Datafile::getObjectId()

Description

This method is used to obtain the object ID of the data file.

Signature
virtual int getObjectId
    (
      void
    ) const
Parameters

None.

Return value

The datafile's object ID, as an integer.

Datafile::getObjectStatus()

Description

This method is used to obtain the data file's object status.

Signature
virtual Object::Status getObjectStatus
    (
      void
    ) const
Parameters

None.

Return value

The data file's Status. See Object::Status.

Datafile::getObjectVersion()

Description

This method retrieves the data file's object version (see NDB Schema Object Versions).

Signature
virtual int getObjectVersion
    (
      void
    ) const
Parameters

None.

Return value

The data file's object version, as an integer.

Datafile::getPath()

Description

This method returns the file system path to the data file.

Signature
const char* getPath
    (
      void
    ) const
Parameters

None.

Return value

The path to the data file on the data node's file system, a string (character pointer).

Datafile::getSize()

Description

This method gets the size of the data file in bytes.

Signature
Uint64 getSize
    (
      void
    ) const
Parameters

None.

Return value

The size of the data file, in bytes, as an unsigned 64-bit integer.

Datafile::getTablespace()

Description

This method can be used to obtain the name of the tablespace to which the data file belongs.

You can also access the associated tablespace's ID directly. See Datafile::getTablespaceId().

Signature
const char* getTablespace
    (
      void
    ) const
Parameters

None.

Return value

The name of the associated tablespace (as a character pointer).

Datafile::getTablespaceId()

Description

This method gets the ID of the tablespace to which the data file belongs.

You can also access the name of the associated tablespace directly. See Datafile::getTablespace().

Signature
Uint32 getTablespaceId
    (
      void
    ) const
Parameters

None.

Return value

This method returns the tablespace ID as an unsigned 32-bit integer.

Datafile::setNode()

Description

This method did not work as intended, and was removed in NDB 7.5.0 (Bug #47960, Bug #11756088).

Signature
void setNode
    (
      Uint32 nodeId
    )
Parameters

The nodeId of the node on which the data file is to be located (an unsigned 32-bit integer value).

Return value

None.

Datafile::setPath()

Description

This method sets the path to the data file on the data node's file system.

Signature
const char* setPath
    (
      void
    ) const
Parameters

The path to the file, a string (as a character pointer).

Return value

None.

Datafile::setSize()

Description

This method sets the size of the data file.

Signature
void setSize
    (
      Uint64 size
    )
Parameters

This method takes a single parameter—the desired size in bytes for the data file, as an unsigned 64-bit integer.

Return value

None.

Datafile::setTablespace()

Description

This method is used to associate the data file with a tablespace.

Signatures

setTablespace() can be invoked in either of the two ways listed here:

  1. Using the name of the tablespace, as shown here:

    void setTablespace
        (
          const char* name
        )
    
  2. Using a reference to a Tablespace object.

    void setTablespace
        (
          const class Tablespace& tablespace
        )
    
Parameters

This method takes a single parameter, which can be either one of the following:

  • The name of the tablespace (as a character pointer).

  • A reference tablespace to the corresponding Tablespace object.

Return value

None.