This is the main documentation for the gora-aerospike module. gora-aerospike module enables Aerospike backend support for Gora.


Gora Aerospike mappings

You should then create a gora-aerospike-mapping.xml which will describe how you want to store each of your Gora persistent objects along with the read and write policies in Aerospike:

    <policy name="write" gen="NONE" recordExists="UPDATE" commitLevel="COMMIT_ALL" durableDelete="false"/>
    <policy name="read" priority="DEFAULT" consistencyLevel="CONSISTENCY_ONE" replica="SEQUENCE" maxRetries="2"/>

    <class name="org.apache.gora.examples.generated.Employee" keyClass="java.lang.String" set="Employee" namespace = "test">
        <field name="name" bin="name"/>
        <field name="dateOfBirth" bin="dateOfBirth"/>
        <field name="ssn" bin="ssn"/>
        <field name="salary" bin="salary"/>
        <field name="boss" bin="boss"/>
        <field name="webpage" bin="webpage"/>

Here you can see that we require the definition of child elements within the gora-otd mapping configuration. We can define the classes and the policies.

Each class element should contain the following elements;

  1. a parameter defining the Persistent class name e.g. org.apache.gora.examples.generated.Employee,

  2. a parameter defining the keyClass e.g. java.lang.String which specifies the key which maps to the field values,

  3. a parameter defining the Aerospike set e.g. Employee which will be used to persist each Gora object,

  4. a parameter defining the Aerospike namespace e.g. test which will be used to persist each Gora object,

In addition, within the class field we should specify the fields and for which bin each field value maps to. We do not need to explicitly specify the type of each field, as the type is automatically detected in Aerospike server when creating the bin values. Thus each field should contain the field name and the corresponding bin it gets mapped to. e.g. name="webpage" bin="webpage"

Further, we can define the policies on reading and writing data from/to the server.

Write policy can have following fields and each field values are the default values supported by Aerospike Write Policy API

  1. gen - generation policy (values: EXPECT_GEN_EQUAL, EXPECT_GEN_GT, NONE)

  2. recordExists - record exists action (values: CREATE_ONLY, REPLACE, REPLACE_ONLY, UPDATE, UPDATE_ONLY)

  3. commitLevel - commit level (values: COMMIT_ALL, COMMIT_MASTER)

  4. durableDelete - durable delete (values: true, false)

  5. expiration - record expiration (values: 0, 10)

Read policy can have following fields and each field values are the default values supported by Aerospike Read Policy API

  1. priority - priority policy (values: DEFAULT, HIGH, LOW, MEDIUM)

  2. consistencyLevel - consistency level (values: CONSISTENCY_ALL, CONSISTENCY_ONE)

  3. replica - replica (values: MASTER, MASTER_PROLES, RANDOM, SEQUENCE)

  4. socketTimeout - socket timeout (values: timeout in milliseconds)

  5. totalTimeout - total timeout (values: timeout in milliseconds)

  6. timeoutDelay - timeout delay (values: timeout in milliseconds)

  7. maxRetries - max retries (values: int of max num of retries)