/api/drd/local/status

GET

Reports health of the local DRD directory replica: live record and tombstone counts, last successful sync time, whether a sync is currently running, and per-shard cursor progress. No parameters. The local replica may lag the live directory; /api/drd/user/get remains the authoritative per-record read.

Parameters

None.

Responses

Success Response (200)

{
    "command": "drd-local-status",
    "success": true,
    "record_count": 12450,
    "tombstone_count": 38,
    "last_sync_at": 1783741315,
    "sync_running": false,
    "shard_count": 10,
    "shards": [
        {
            "raida_id": 0,
            "shard_index": 0,
            "cursor_updated_at": 1783741000,
            "last_sync_at": 1783741315,
            "completed": true
        },
        {
            "raida_id": 3,
            "shard_index": 1,
            "cursor_updated_at": 1783740900,
            "last_sync_at": 1783741310,
            "completed": true
        }
    ]
}
Field Type Description
record_count integer Live (non-tombstone) records in the local store.
tombstone_count integer Tombstone rows retained for sync propagation.
last_sync_at integer Unix seconds of the latest sync progress (store max, or engine value if fresher mid-cycle). 0 if never synced.
sync_running boolean true while a sync task is active.
shard_count integer Number of shard slots currently tracked (≤ 25).
shards[] array Per-shard status objects (see below).
shards[].raida_id integer RAIDA server holding this shard's feed.
shards[].shard_index integer Shard index within the sync plan.
shards[].cursor_updated_at integer Cursor timestamp for the next GetChanges page.
shards[].last_sync_at integer Unix seconds when this shard last made progress.
shards[].completed boolean Whether this shard finished its current cycle page walk.

Error Responses

503 Service Unavailable

The local replica store is not open (not initialized).

{
    "error": true,
    "message": "Local DRD replica not initialized",
    "code": 503
}

500 Internal Server Error

Failed to read store counts or last-sync metadata.

{
    "error": true,
    "message": "Failed to read local DRD counts",
    "code": 500
}

Examples

cURL Example

curl -X GET "http://localhost:8080/api/drd/local/status"

JavaScript Example

fetch(`http://localhost:8080/api/drd/local/status`)
    .then(r => r.json())
    .then(data => {
        if (data.success) {
            const when = data.last_sync_at
                ? new Date(data.last_sync_at * 1000).toISOString()
                : 'never';
            console.log(`${data.record_count} records, last sync ${when}` +
                        (data.sync_running ? ' (sync running)' : ''));
        } else if (data.code === 503) {
            console.log('Replica not initialized');
        }
    });

Python Example

import requests

url = 'http://localhost:8080/api/drd/local/status'
data = requests.get(url).json()

if data.get('success'):
    print(f"records={data['record_count']} tombstones={data['tombstone_count']} "
          f"running={data['sync_running']} shards={data['shard_count']}")
    for s in data.get('shards', []):
        print(f"  RAIDA {s['raida_id']} shard {s['shard_index']}: "
              f"completed={s['completed']}")
elif data.get('code') == 503:
    print('Local DRD replica not initialized')

Notes

  • Does not start a sync; use /api/drd/local/sync to kick one.
  • The core also syncs on a timer when drd_sync_enabled=true (drd_sync_interval_minutes, default 60).
  • The local replica may lag the live directory. Search locally with /api/drd/local/search; for a single authoritative record use /api/drd/user/get.