文件首頁
MySQL NDB Cluster API 開發者指南
相關文件 下載本手冊
PDF (美國信紙) - 3.6Mb
PDF (A4) - 3.6Mb


2.3.28 表空間類別

本節提供有關 Tablespace 類別的資訊。

表空間類別概觀

父類別

NdbDictionary

子類別

描述

Tablespace 類別會為 NDB Cluster 磁碟資料表空間建立模型,其中包含用於儲存叢集磁碟資料的資料檔案。如需叢集磁碟資料與資料檔案特性的概觀,請參閱 MySQL 手冊中的 CREATE TABLESPACE 陳述式

只有未編製索引的欄資料可以儲存在磁碟上。索引和索引欄一律儲存在記憶體中。

方法

下表列出此類別的公用方法,以及每個方法的用途或用法

表格 2.81 表空間類別方法與描述

名稱 描述
Tablespace() 類別建構函式
~Tablespace() 虛擬解構函式方法
getAutoGrowSpecification() 用於取得與表空間相關聯的 AutoGrowSpecification 結構
getDefaultLogfileGroup() 取得表空間預設日誌檔案群組的名稱
getDefaultLogfileGroupId() 取得表空間預設日誌檔案群組的 ID
getExtentSize() 取得表空間使用的範圍大小
getName() 取得表空間的名稱
getObjectId() 取得 Tablespace 執行個體的物件 ID
getObjectStatus() 用於取得呼叫它的 Tablespace 執行個體的 Object::Status
getObjectVersion() 取得呼叫它的 Tablespace 物件的物件版本
setAutoGrowSpecification() 用於設定表空間的自動成長特性
setDefaultLogfileGroup() 設定表空間的預設日誌檔案群組
setExtentSize() 設定表空間使用的範圍大小
setName() 設定表空間的名稱

類型

表空間類別未定義其自身的公用類型;不過,其兩個方法會使用 AutoGrowSpecification 資料結構。

表空間建構函式

描述

這些方法用於建立 Tablespace 的新執行個體,或是複製現有的執行個體。

注意

Dictionary 類別也會提供用於建立與捨棄表空間的方法。

簽章。  新執行個體

Tablespace
    (
      void
    )

複製建構函式

Tablespace
    (
      const Tablespace& tablespace
    )
參數

新執行個體:。複製建構函式:現有 Tablespace 執行個體的參考。

傳回值

Tablespace 物件。

解構函式。  類別會定義虛擬解構函式 ~Tablespace(),此函式不接受任何引數且不傳回值。

Tablespace::getAutoGrowSpecification()

描述。 

簽章
const AutoGrowSpecification& getAutoGrowSpecification
    (
      void
    ) const
參數

.

傳回值

描述表空間自動成長特性的結構參考;如需詳細資訊,請參閱 NdbDictionary::AutoGrowSpecification

Tablespace::getDefaultLogfileGroup()

描述

此方法會擷取表空間預設日誌檔案群組的名稱。

或者,您可能想要取得預設日誌檔案群組的 ID;請參閱 Tablespace::getDefaultLogfileGroupId()

簽章
const char* getDefaultLogfileGroup
    (
      void
    ) const
參數

.

傳回值

日誌檔案群組的名稱(字元指標的字串值)。

Tablespace::getDefaultLogfileGroupId()

描述

此方法會擷取表空間預設日誌檔案群組的 ID。

您也可以直接取得預設日誌檔案群組的名稱,而非其 ID;請參閱 Tablespace::getDefaultLogfileGroup()

簽章
Uint32 getDefaultLogfileGroupId
    (
      void
    ) const
參數

.

傳回值

日誌檔案群組的 ID,以不帶正負號的 32 位元整數表示。

Tablespace::getExtentSize()

描述

此方法用於擷取 範圍大小,也就是表空間使用的記憶體配置單位大小。

注意

相同範圍大小用於指定表空間中包含的所有資料檔案。

簽章
Uint32 getExtentSize
    (
      void
    ) const
參數

.

傳回值

表空間的範圍大小(以位元組為單位),以不帶正負號的 32 位元整數表示。

Tablespace::getObjectId()

描述

此方法會擷取表空間的物件 ID。

簽章
virtual int getObjectId
    (
      void
    ) const
參數

.

傳回值

物件 ID,以整數表示。

Tablespace::getName()

描述

此方法會擷取表空間的名稱。

簽章
const char* getName
    (
      void
    ) const
參數

.

傳回值

表空間的名稱,為字串值(以字元指標表示)。

Tablespace::getObjectStatus()

描述

此方法用於擷取表空間的物件狀態。

簽章
virtual Object::Status getObjectStatus
    (
      void
    ) const
參數

.

傳回值

Object::Status 值。

Tablespace::getObjectVersion()

描述

此方法會取得表空間物件版本(請參閱 NDB 綱要物件版本)。

簽章
virtual int getObjectVersion
  (
    void
  ) const
參數

.

傳回值

物件版本,以整數表示。

Tablespace::setAutoGrowSpecification()

描述

此方法用於設定表空間的自動成長特性。

簽章
void setAutoGrowSpecification
    (
      const AutoGrowSpecification& autoGrowSpec
    )
參數

此方法會採用單一參數,也就是 AutoGrowSpecification 資料結構。

傳回值

.

Tablespace::setDefaultLogfileGroup()

描述

此方法用於設定表空間的預設日誌檔案群組。

簽章

此方法可以兩種不同方式呼叫。第一種方式使用日誌檔案群組的名稱,如下所示

void setDefaultLogfileGroup
    (
      const char* name
    )

此方法也可以透過傳遞 LogfileGroup 物件的參考來呼叫

void setDefaultLogfileGroup
    (
      const class LogfileGroup& lGroup
    )

NDB API 未提供任何方法,透過參考日誌檔案群組的 ID 來設定日誌檔案群組作為表空間的預設群組。

參數

要指派給表空間的日誌檔案群組的 name,或是這個日誌檔案群組的參考 lGroup

傳回值

.

Tablespace::setExtentSize()

描述

此方法會設定表空間的範圍大小。

簽章
void setExtentSize
    (
      Uint32 size
    )
參數

此表空間範圍要使用的 size,以位元組為單位。

傳回值

.

Tablespace::setName()

描述

此方法會設定表空間的名稱。

簽章
void setName
    (
      const char* name
    ) const
參數

表空間的 name,為字串(字元指標)。

傳回值

.