Skip to main content

Crate torna_sdk

Crate torna_sdk 

Source
Expand description

Torna client SDK – the PathPlanner.

Integrators call insert/update/delete/find with a 32-byte key; the planner reads the tree off-chain (via an AccountReader) and produces a ready Instruction with the exact account set. node_idx, bumps, paths, and spares never leak out.

Layout constants mirror the FROZEN ABI (torna_docs/abi.md). If the engine layout changes, change it here too – the cpitest/inttest in torna/integration will catch a mismatch because the SDK-built instructions run against the real torna.so.

Modules§

keys
Orderbook key convention (CLOB-specific; the core Tree is key-agnostic).

Structs§

Header
Parsed, cache-relevant header fields.
Tree
A handle to one tree: (program, creator, tree_id). All PDA/seed logic lives here.

Enums§

Attempt
One resolve+submit attempt for retry.

Constants§

ALLOC_SIZE
ERR_BAD_PATH
ERR_DUPLICATE_KEY
ERR_KEY_NOT_FOUND
ERR_NEED_SPLIT_SLOT
IX_DELETE
IX_DELETE_FAST
IX_FIND
IX_INIT_TREE
IX_INSERT
IX_INSERT_FAST
IX_UPDATE_FAST
KEY_SIZE
NODE_HDR
TREE_HEADER_SIZE

Traits§

AccountReader
Anything that can fetch raw account data (LiteSVM, RPC, a cache).

Functions§

retry
Re-resolve + resubmit up to attempts times. f should resolve the instruction from FRESH state (the planner reads live accounts each call) and submit it, returning Attempt::Stale to retry. This is the SDK’s staleness model: splits are rare (leaf-full), but between resolving a path and the tx landing a concurrent writer may have split/merged a node, invalidating node_idx -> ERR_BAD_PATH; the client just re-resolves. Compare Header::structure_epoch to detect it cheaply.