2.3.3.1 Datafile Methods

2.3.3.1.1 Datafile Class Constructor
2.3.3.1.2 Datafile::getFileNo()
2.3.3.1.3 Datafile::getFree()
2.3.3.1.4 Datafile::getNode()
2.3.3.1.5 Datafile::getObjectId()
2.3.3.1.6 Datafile::getObjectStatus()
2.3.3.1.7 Datafile::getObjectVersion()
2.3.3.1.8 Datafile::getPath()
2.3.3.1.9 Datafile::getSize()
2.3.3.1.10 Datafile::getTablespace()
2.3.3.1.11 Datafile::getTablespaceId()
2.3.3.1.12 Datafile::setNode()
2.3.3.1.13 Datafile::setPath()
2.3.3.1.14 Datafile::setSize()
2.3.3.1.15 Datafile::setTablespace()

Abstract

This section provides descriptions of the public methods of the Datafile class.

2.3.3.1.1 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.

2.3.3.1.2 Datafile::getFileNo()

Description.  This method gets the number of the file within the associated tablespace.

Signature. 

Uint32 getFileNo
    (
      void
    ) const

Parameters.  None.

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

2.3.3.1.3 Datafile::getFree()

Description.  This method gets the free space available in the datafile.

Signature. 

Uint64 getFree
    (
      void
    ) const

Parameters.  None.

Return value.  The number of bytes free in the datafile, as an unsigned 64-bit integer.

2.3.3.1.4 Datafile::getNode()

Description.  This method retrieves the ID of the data node on which the datafile resides.

Signature. 

Uint32 getNode
    (
      void
    ) const

Parameters.  None.

Return value.  The node ID as an unsigned 32-bit integer.

2.3.3.1.5 Datafile::getObjectId()

Description.  This method is used to obtain the object ID of the datafile.

Signature. 

virtual int getObjectId
    (
      void
    ) const

Parameters.  None.

Return value.  The datafile's object ID, as an integer.

2.3.3.1.6 Datafile::getObjectStatus()

Description.  This method is used to obtain the datafile's object status.

Signature. 

virtual Object::Status getObjectStatus
    (
      void
    ) const

Parameters.  None.

Return value.  The datafile's Status. See Section 2.3.30.1.3, “The Object::Status Type”.

2.3.3.1.7 Datafile::getObjectVersion()

Description.  This method retrieves the datafile's object version (see Section 8.6, “NDB Schema Object Versions”).

Signature. 

virtual int getObjectVersion
    (
      void
    ) const

Parameters.  None.

Return value.  The datafile's object version, as an integer.

2.3.3.1.8 Datafile::getPath()

Description.  This method returns the file system path to the datafile.

Signature. 

const char* getPath
    (
      void
    ) const

Parameters.  None.

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

2.3.3.1.9 Datafile::getSize()

Description.  This method gets the size of the datafile 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.

2.3.3.1.10 Datafile::getTablespace()

Description.  This method can be used to obtain the name of the tablespace to which the datafile belongs.

Note

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

Signature. 

const char* getTablespace
    (
      void
    ) const

Parameters.  None.

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

2.3.3.1.11 Datafile::getTablespaceId()

Description.  This method gets the ID of the tablespace to which the datafile belongs.

Note

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

Signature. 

Uint32 getTablespaceId
    (
      void
    ) const

Parameters.  None.

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

2.3.3.1.12 Datafile::setNode()

Description.  Designates the node to which this datafile belongs.

Signature. 

void setNode
    (
      Uint32 nodeId
    )

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

Return value.  None.

2.3.3.1.13 Datafile::setPath()

Description.  This method sets the path to the datafile 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.

2.3.3.1.14 Datafile::setSize()

Description.  This method sets the size of the datafile.

Signature. 

void setSize
    (
      Uint64 size
    )

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

Return value.  None.

2.3.3.1.15 Datafile::setTablespace()

Description.  This method is used to associate the datafile with a tablespace.

Signatures.  setTablespace() can be invoked in either of two ways, listed here:

  • Using the name of the tablespace, as shown here:

    void setTablespace
        (
          const char* name
        )
    
  • 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.