Product Documentation

FairCom DB V12 Updates

Previous Topic

Next Topic

REST API Support for Auto-Purge

The Auto-Purge feature is available in the REST API. This feature requires a partitioned table, which is set up as shown below. You will define a rule that will determine the partition number (for example, you might use part of the datetime stamp to create a partition for every day or month). You will also specify the maximum number of active partitions. After this value has been exceeded, partitions will be deleted automatically.

To create a partitioned table, you need to create a "partition index" on an existing table. The JSON request syntax to create an index includes a partition property that allows specifying a partitioned file setting as follows:

partition {

description:

Optional parameter. If set the index is a partition index and the table becomes a partitioned table with the settings defined by this property

rule* string

Expression that evaluates into an integer that will be used as partition number.

numberofbits integer

Optional parameter. Set the number of bits used to store the raw partition number. By default, 16 bits of the 64-bit record offset are used to reference the raw partition number, allowing each partitioned file to support up to 65535 member files over its lifetime. A value of 0 defaults to 16 bits, values less than 4 bits default to 4 bits (maximum 15 member files), and 32 bits is the maximum value.

maximumactive integer

Number of maximum active partitions. When this maximum is exceeded, c-tree's auto purging feature takes care of purging.

}

Below is an example of use:

{

"unique": true,

"fields": [

{

"name": "custnumb",

"ascending": true

}

],

"partition": {

"rule": "custnumb - 1",

"numberofbits": 16,

"maximumactive": 30

}

}

The JSON returned when describing the table includes "remarks" information about the partitioned file setting. The "remarks" property is ignored when defining the table structure. Below is an example:

remarks {

description:

Read only optional property. Contains information about the table structure that are set

thru other means than a table definition during creation

partitioned {

description:

the table is a partitioned table

partition_index string

The name of the partition index

rule string

The partition rule

numberofbits integer

Optional parameter. Set the number of bits used to store the raw partition number.

By default, 16 bits of the 64-bit record offset are used to reference the raw partition number,

allowing each partitioned file to support up to 65535 member files over its lifetime.

A value of 0 defaults to 16 bits, values less than 4 bits default to 4 bits (maximum 15 member

files), and 32 bits is the maximum value.

maximumactive integer

number of maximum active partitions, when exceeding the maximum c-tree's auto purging feature

takes care of purging

}

}

Example:

{

"fields": [

{

"name": "custnumb",

"type": "INTEGER"

},

{

"name": "custzipc",

"type": "CHAR",

"length": 9

},

{

"name": "custstat",

"type": "CHAR",

"length": 2

},

{

"name": "custrtng",

"type": "CHAR",

"length": 1

},

{

"name": "custname",

"type": "VARCHAR",

"length": 47

},

{

"name": "custaddr",

"type": "VARCHAR",

"length": 47

},

{

"name": "custcity",

"type": "VARCHAR",

"length": 47

}

],

"remarks": {

"partitioned": {

"partition_index": "partidx2",

"rule": "custnumb - 1",

"numberofbits": 16,

"maximumactive": 30

}

}

}

TOCIndex