Persistence Layer

The Persistence Layer was created to allow us to push data to Makaira from one or multiple sources instead of just one like the traditional way where you push data directly to Makaira.

Difference Between Persistence Layer Data Flow and Normal Data Flow

Normal Data Flow

Persistence Data Flow

Pushing Data to the Persistence Layer

Direct Data Push

You can push data to the Persistence Layer using this API: https://docs.makaira.io/reference/put_persistence-revisions

🚧

source_identifier must be specified in the request body for the Persistence Layer to distinguish between data sources.

Data Push Using Makaira Importers

The importer configuration should look like this:

👍

You can configure multiple importers for data from various sources.

📘 Optionally, create multiple importers for different languages in your datasource to speed up the import process.

Creating a Makaira Importer to Pull Data from the Persistence Layer

🚧

Data must be imported into the Persistence Layer before proceeding.

The importer configuration should look like this:

Rebuilding Your Data

Notify the Persistence Layer of Data Rebuild

Use this API to trigger the rebuild: https://docs.makaira.io/reference/post_persistence-revisions-rebuild

📘

You can either:

  • Trigger the rebuild for all document types:
    {
        "entities": []
    }
  • Trigger a rebuild for specific document types. The example below will trigger a product rebuild:
    {
        "entities": [
            {
                "doc_type": "product",
                "languages": [
                    "de",
                    "en"
                ]
            }
        ]
    }

Importing Data

Use the same API for direct data push: https://docs.makaira.io/reference/put_persistence-revisions

The request body will differ slightly:

{
    "import_timestamp": "2023-01-01 00:00:00",
    "source_identifier": "your_source_identifier",
    "rebuild": true,
    "items": [
        {
            "source_revision": "1",
            "delete": false,
            "language_id": "de",
            "data": {
                # Your data
            }
        }
    ]
}

The key difference is "rebuild": true, indicating that this is a rebuilding request.

Notify the Persistence Layer When Importing is Complete

Use this API: https://docs.makaira.io/reference/post_persistence-revisions-switch

📘

Similar to the rebuild process, you can either:

  • Trigger the switch for all document types:
    {
        "entities": []
    }
  • Trigger a switch for specific document types. The example below will trigger a product switch:
    {
        "entities": [
            {
                "doc_type": "product",
                "languages": [
                    "de",
                    "en"
                ]
            }
        ]
    }