Reference

API Reference

Three interfaces, one algebra. Every API exposes the same four operations: LOAD, ACCUM, READ, SWAP.

Python

pip install atomik-core
  • AtomikContext
  • AtomikTable
  • DeltaStream
  • Fingerprint

C

#include "atomik_core.h"
  • atomik_ctx_t
  • atomik_table_t
  • atomik_fingerprint_t

Kernel Module

sudo ./install.sh
  • ATOMIK_IOC_LOAD
  • ATOMIK_IOC_ACCUM
  • ATOMIK_IOC_READ
  • ATOMIK_IOC_SWAP
  • ATOMIK_IOC_BATCH
Team

Generate SDKs in 5 Languages

Team tier includes the SDK generation pipeline: Python, Rust, C, JavaScript, and Verilog from a single schema definition.

Start Team Trial

Core Operations

Every ATOMiK SDK exposes the same four operations. Select a language to see signatures, descriptions, and examples.

Context / Create

ctx = AtomikContext()

Create a new ATOMiK context. A context holds a reference state and an accumulator, providing the four core delta-state operations.

Returns

A new context instance with reference = 0 and accumulator = 0.

Example
from atomik_core import AtomikContext

ctx = AtomikContext()
# ctx.reference == 0, ctx.accumulator == 0

load

ctx.load(value: int) -> None

Set the reference state to the given value and reset the accumulator to zero. This establishes the baseline from which all subsequent deltas are measured.

Returns

None. The context is mutated in place.

Example
ctx.load(0xCAFEBABE)
# reference = 0xCAFEBABE, accumulator = 0

accum

ctx.accum(delta: int) -> None

XOR a delta value into the accumulator. This records a state change without modifying the reference. Multiple accum calls compose: accum(a); accum(b) is equivalent to accum(a XOR b).

Returns

None. The accumulator is updated in place via XOR.

Example
ctx.load(100)
ctx.accum(7)   # accumulator ^= 7
ctx.accum(3)   # accumulator ^= 3 (same as single accum(7^3))

read

ctx.read() -> int

Reconstruct the current state by XOR-ing the reference with the accumulator. This is a pure computation: current_state = reference XOR accumulator. The context is not modified.

Returns

The reconstructed state value (reference XOR accumulator).

Example
ctx.load(0xFF00)
ctx.accum(0x00FF)
state = ctx.read()
assert state == 0xFFFF  # 0xFF00 ^ 0x00FF

swap

ctx.swap() -> int

Checkpoint the current state: sets reference = reference XOR accumulator, then resets accumulator to zero. After swap, read() returns the same value as before, but the accumulator is clean for a new round of deltas.

Returns

The checkpointed state value (the new reference). In C, returned as uint64_t.

Example
ctx.load(1000)
ctx.accum(50)
saved = ctx.swap()
# saved == 1000 ^ 50 == 1018
# ctx.reference == 1018, ctx.accumulator == 0

Multi-Context Tables

Track thousands of independent state channels in a single table.

Python

from atomik_core import AtomikTable

table = AtomikTable(num_contexts=256)
table.load(addr=0, initial_state=0xCAFEBABE)
table.accum(addr=0, delta=0x00000001)
assert table.read(addr=0) == 0xCAFEBABF

C (single-header library)

#define ATOMIK_IMPLEMENTATION
#include "atomik_core.h"

atomik_table_t table;
atomik_table_init(&table, 256);
atomik_table_load(&table, 0, 0xCAFEBABE);
atomik_table_accum(&table, 0, 0x00000001);
uint64_t s = atomik_table_read(&table, 0);
// s == 0xCAFEBABF