1919namespace griddb {
2020
2121 PartitionController::PartitionController (GSPartitionController *controller) :
22- mController (controller) {
22+ mController (controller) {
2323 }
24-
2524 /* *
2625 * Destructor. Convert from C-API:gsClosePartitionController
2726 */
2827 PartitionController::~PartitionController () {
2928 close ();
3029 }
31-
3230 void PartitionController::close () {
3331 if (mController != NULL ) {
3432 gsClosePartitionController (&mController );
3533 mController = NULL ;
3634 }
3735 }
38-
3936 /* *
4037 * Get partition count. Convert from C-Api: gsGetPartitionCount
4138 */
@@ -49,78 +46,64 @@ namespace griddb {
4946 }
5047 return value;
5148 }
52-
5349 /* *
5450 * Get container partition count. Convert from C-Api: gsGetPartitionContainerCount
5551 */
56- int64_t PartitionController::get_container_count (
57- int32_t partition_index) {
52+ int64_t PartitionController::get_container_count (int32_t partition_index) {
5853 int64_t value;
59- GSResult ret = gsGetPartitionContainerCount (mController , partition_index,
60- &value);
54+ GSResult ret = gsGetPartitionContainerCount (mController , partition_index,&value);
6155
6256 // Check ret, if error, throw exception
6357 if (ret != GS_RESULT_OK) {
6458 throw GSException (mController , ret);
6559 }
6660 return value;
6761 }
68-
6962 /* *
7063 * Get list partition container names case there is limit. Convert from C-Api: gsGetPartitionContainerNames
7164 */
72- void PartitionController::get_container_names (int32_t partitionIndex,
73- int64_t start, const GSChar * const ** stringList, size_t *size,
74- int64_t limit) {
65+ void PartitionController::get_container_names (int32_t partitionIndex, int64_t start,
66+ const GSChar * const ** stringList, size_t *size, int64_t limit) {
7567 int64_t * limitPtr;
7668 if (limit >= 0 ) {
7769 limitPtr = &limit;
7870 } else {
7971 limitPtr = NULL ;
8072 }
81- GSResult ret = gsGetPartitionContainerNames (mController , partitionIndex,
82- start, limitPtr, stringList, size);
73+ GSResult ret = gsGetPartitionContainerNames (mController , partitionIndex, start, limitPtr, stringList, size);
8374
8475 if (ret != GS_RESULT_OK) {
8576 throw GSException (mController , ret);
8677 }
8778 }
88-
8979 /* *
9080 * Get get_partition hosts. Convert from C-Api: gsGetPartitionHosts
9181 */
92- void PartitionController::get_partition_hosts (int32_t partitionIndex,
93- const GSChar * const **stringList, size_t *size) {
94- GSResult ret = gsGetPartitionHosts (mController , partitionIndex, stringList,
95- size);
82+ void PartitionController::get_partition_hosts (int32_t partitionIndex, const GSChar * const **stringList, size_t *size) {
83+ GSResult ret = gsGetPartitionHosts (mController , partitionIndex, stringList, size);
9684
9785 // Check ret, if error, throw exception
9886 if (ret != GS_RESULT_OK) {
9987 throw GSException (mController , ret);
10088 }
10189 }
102-
10390 /* *
10491 * Get get_partition index of container. Convert from C-Api: gsGetPartitionIndexOfContainer
10592 */
106- int32_t PartitionController::get_partition_index_of_container (
107- const GSChar* container_name) {
93+ int32_t PartitionController::get_partition_index_of_container (const GSChar* container_name) {
10894 int32_t value;
109- GSResult ret = gsGetPartitionIndexOfContainer (mController , container_name,
110- &value);
95+ GSResult ret = gsGetPartitionIndexOfContainer (mController , container_name, &value);
11196
11297 // Check ret, if error, throw exception
11398 if (ret != GS_RESULT_OK) {
11499 throw GSException (mController , ret);
115100 }
116101 return value;
117102 }
118-
119103 /* *
120104 * Get get_partition owner host. Convert from C-Api: gsGetPartitionOwnerHost
121105 */
122- string PartitionController::get_partition_owner_host (
123- int32_t partitionIndex) {
106+ string PartitionController::get_partition_owner_host (int32_t partitionIndex) {
124107 const GSChar *address;
125108 GSResult ret = gsGetPartitionOwnerHost (mController , partitionIndex, &address);
126109
@@ -134,10 +117,8 @@ namespace griddb {
134117 /* *
135118 * Get get_partition backup hosts. Convert from C-Api: gsGetPartitionBackupHosts
136119 */
137- void PartitionController::get_partition_backup_hosts (
138- int32_t partitionIndex, const GSChar *const **stringList, size_t *size) {
139- GSResult ret = gsGetPartitionBackupHosts (mController , partitionIndex,
140- stringList, size);
120+ void PartitionController::get_partition_backup_hosts (int32_t partitionIndex, const GSChar *const **stringList, size_t *size) {
121+ GSResult ret = gsGetPartitionBackupHosts (mController , partitionIndex, stringList, size);
141122
142123 // Check ret, if error, throw exception
143124 if (ret != GS_RESULT_OK) {
@@ -148,8 +129,7 @@ namespace griddb {
148129 /* *
149130 * Assign host. Convert from C-Api: gsAssignPartitionPreferableHost
150131 */
151- void PartitionController::assign_partition_preferable_host (
152- int32_t partitionIndex, const GSChar* host) {
132+ void PartitionController::assign_partition_preferable_host (int32_t partitionIndex, const GSChar* host) {
153133 GSResult ret = gsAssignPartitionPreferableHost (mController , partitionIndex, host);
154134 if (ret != GS_RESULT_OK) {
155135 throw new GSException (ret);
0 commit comments