@@ -69,6 +69,59 @@ func newArrayFromHandle(tdbCtx *Context, arrayHandle arrayHandle) *Array {
69
69
return & Array {context : tdbCtx , tiledbArray : arrayHandle }
70
70
}
71
71
72
+ // ConsolidateArray consolidates the fragments of an array into a single fragment.
73
+ // You must first finalize all queries to the array before consolidation can
74
+ // begin (as consolidation temporarily acquires an exclusive lock on the array).
75
+ func ConsolidateArray (tdbCtx * Context , uri string , config * Config ) error {
76
+ if config == nil {
77
+ return errors .New ("Config must not be nil for Consolidate" )
78
+ }
79
+
80
+ curi := C .CString (uri )
81
+ defer C .free (unsafe .Pointer (curi ))
82
+ ret := C .tiledb_array_consolidate (tdbCtx .tiledbContext .Get (), curi , config .tiledbConfig .Get ())
83
+ runtime .KeepAlive (tdbCtx )
84
+ runtime .KeepAlive (config )
85
+ if ret != C .TILEDB_OK {
86
+ return fmt .Errorf ("error consolidating tiledb array: %w" , tdbCtx .LastError ())
87
+ }
88
+
89
+ runtime .KeepAlive (config )
90
+ return nil
91
+ }
92
+
93
+ // CreateArray creates a new TileDB array given a context, URI and schema.
94
+ func CreateArray (tdbCtx * Context , uri string , arraySchema * ArraySchema ) error {
95
+ curi := C .CString (uri )
96
+ defer C .free (unsafe .Pointer (curi ))
97
+ ret := C .tiledb_array_create (tdbCtx .tiledbContext .Get (), curi , arraySchema .tiledbArraySchema .Get ())
98
+ runtime .KeepAlive (tdbCtx )
99
+ runtime .KeepAlive (arraySchema )
100
+ if ret != C .TILEDB_OK {
101
+ return fmt .Errorf ("error creating tiledb array: %w" , tdbCtx .LastError ())
102
+ }
103
+ return nil
104
+ }
105
+
106
+ // VacuumArray cleans up an array, such as consolidated fragments and array metadata.
107
+ func VacuumArray (tdbCtx * Context , uri string , config * Config ) error {
108
+ if config == nil {
109
+ return errors .New ("Config must not be nil for Vacuum" )
110
+ }
111
+
112
+ curi := C .CString (uri )
113
+ defer C .free (unsafe .Pointer (curi ))
114
+ ret := C .tiledb_array_vacuum (tdbCtx .tiledbContext .Get (), curi , config .tiledbConfig .Get ())
115
+ runtime .KeepAlive (tdbCtx )
116
+ runtime .KeepAlive (config )
117
+ if ret != C .TILEDB_OK {
118
+ return fmt .Errorf ("error vacuuming tiledb array: %w" , tdbCtx .LastError ())
119
+ }
120
+
121
+ runtime .KeepAlive (config )
122
+ return nil
123
+ }
124
+
72
125
// NewArray allocates a new array.
73
126
// If the provided Context is nil, a default context is allocated and used.
74
127
func NewArray (tdbCtx * Context , uri string ) (* Array , error ) {
@@ -221,46 +274,12 @@ func (a *Array) Close() error {
221
274
return nil
222
275
}
223
276
224
- // CreateArray creates a new TileDB array given a context, URI and schema.
225
- func CreateArray (tdbCtx * Context , uri string , arraySchema * ArraySchema ) error {
226
- curi := C .CString (uri )
227
- defer C .free (unsafe .Pointer (curi ))
228
- ret := C .tiledb_array_create (tdbCtx .tiledbContext .Get (), curi , arraySchema .tiledbArraySchema .Get ())
229
- runtime .KeepAlive (tdbCtx )
230
- runtime .KeepAlive (arraySchema )
231
- if ret != C .TILEDB_OK {
232
- return fmt .Errorf ("error creating tiledb array: %w" , tdbCtx .LastError ())
233
- }
234
- return nil
235
- }
236
-
237
277
// Create creates a new TileDB array given an input schema.
238
278
// Deprecated: Use CreateArray instead.
239
279
func (a * Array ) Create (arraySchema * ArraySchema ) error {
240
280
return CreateArray (a .context , a .uri , arraySchema )
241
281
}
242
282
243
- // ConsolidateArray consolidates the fragments of an array into a single fragment.
244
- // You must first finalize all queries to the array before consolidation can
245
- // begin (as consolidation temporarily acquires an exclusive lock on the array).
246
- func ConsolidateArray (tdbCtx * Context , uri string , config * Config ) error {
247
- if config == nil {
248
- return errors .New ("Config must not be nil for Consolidate" )
249
- }
250
-
251
- curi := C .CString (uri )
252
- defer C .free (unsafe .Pointer (curi ))
253
- ret := C .tiledb_array_consolidate (tdbCtx .tiledbContext .Get (), curi , config .tiledbConfig .Get ())
254
- runtime .KeepAlive (tdbCtx )
255
- runtime .KeepAlive (config )
256
- if ret != C .TILEDB_OK {
257
- return fmt .Errorf ("error consolidating tiledb array: %w" , tdbCtx .LastError ())
258
- }
259
-
260
- runtime .KeepAlive (config )
261
- return nil
262
- }
263
-
264
283
// Consolidate consolidates the fragments of the array into a single fragment.
265
284
// You must first finalize all queries to the array before consolidation can
266
285
// begin (as consolidation temporarily acquires an exclusive lock on the array).
@@ -269,25 +288,6 @@ func (a *Array) Consolidate(config *Config) error {
269
288
return ConsolidateArray (a .context , a .uri , config )
270
289
}
271
290
272
- // VacuumArray cleans up an array, such as consolidated fragments and array metadata.
273
- func VacuumArray (tdbCtx * Context , uri string , config * Config ) error {
274
- if config == nil {
275
- return errors .New ("Config must not be nil for Vacuum" )
276
- }
277
-
278
- curi := C .CString (uri )
279
- defer C .free (unsafe .Pointer (curi ))
280
- ret := C .tiledb_array_vacuum (tdbCtx .tiledbContext .Get (), curi , config .tiledbConfig .Get ())
281
- runtime .KeepAlive (tdbCtx )
282
- runtime .KeepAlive (config )
283
- if ret != C .TILEDB_OK {
284
- return fmt .Errorf ("error vacuuming tiledb array: %w" , tdbCtx .LastError ())
285
- }
286
-
287
- runtime .KeepAlive (config )
288
- return nil
289
- }
290
-
291
291
// Vacuum cleans up the array, such as consolidated fragments and array metadata.
292
292
// Deprecated: Use VacuumArray instead.
293
293
func (a * Array ) Vacuum (config * Config ) error {
0 commit comments