Skip to content

NBT and the key-value database

Section notes in abi.h

§I NBT binary, KvDb (thread-safe), system & server info

Slots

nbt_snbt_to_binary

C
bool (*nbt_snbt_to_binary)(PierStr snbt, int32_t fmt, void* ctx, PierBytesSink sink);

fmt: 0=disk little-endian, 1=network.

  • Call: api->nbt_snbt_to_binary(snbt, fmt, ctx, sink)
  • Parameters:
    • snbt : PierStr
    • fmt : int32_t
    • ctx : void*
    • sink : PierBytesSink
  • Return type: bool
  • Section of abi.h: §I NBT binary, KvDb (thread-safe), system & server info
  • Position in the table: slot 58, counting from 0
  • Callers in each binding:

nbt_binary_to_snbt

C
bool (*nbt_binary_to_snbt)(uint8_t const* data, size_t len, int32_t fmt, void* ctx, PierStrSink sink);
  • Call: api->nbt_binary_to_snbt(data, len, fmt, ctx, sink)
  • Parameters:
    • data : uint8_t const*
    • len : size_t
    • fmt : int32_t
    • ctx : void*
    • sink : PierStrSink
  • Return type: bool
  • Section of abi.h: §I NBT binary, KvDb (thread-safe), system & server info
  • Position in the table: slot 59, counting from 0
  • Callers in each binding:

kvdb_open

C
PierKvDbHandle (*kvdb_open)(PierModHandle mod, PierStr path, bool create_if_missing);

Group note

KvDb: THREAD-SAFE (internal mutex). Paths are confined to the mod's own data directory; ".." and absolute paths are rejected. Handles are owned by the loader and force-closed (with a warning) at mod unload.

  • Call: api->kvdb_open(mod, path, create_if_missing)
  • Parameters:
    • mod : PierModHandle
    • path : PierStr
    • create_if_missing : bool
  • Return type: PierKvDbHandle
  • Section of abi.h: §I NBT binary, KvDb (thread-safe), system & server info
  • Position in the table: slot 60, counting from 0
  • Callers in each binding:

kvdb_close

C
void (*kvdb_close)(PierKvDbHandle h);

Group note

KvDb: THREAD-SAFE (internal mutex). Paths are confined to the mod's own data directory; ".." and absolute paths are rejected. Handles are owned by the loader and force-closed (with a warning) at mod unload.

  • Call: api->kvdb_close(h)
  • Parameters:
    • h : PierKvDbHandle
  • Section of abi.h: §I NBT binary, KvDb (thread-safe), system & server info
  • Position in the table: slot 61, counting from 0
  • Callers in each binding:

kvdb_get

C
bool (*kvdb_get)(PierKvDbHandle h, PierStr key, void* ctx, PierStrSink sink);

Group note

KvDb: THREAD-SAFE (internal mutex). Paths are confined to the mod's own data directory; ".." and absolute paths are rejected. Handles are owned by the loader and force-closed (with a warning) at mod unload.

  • Call: api->kvdb_get(h, key, ctx, sink)
  • Parameters:
    • h : PierKvDbHandle
    • key : PierStr
    • ctx : void*
    • sink : PierStrSink
  • Return type: bool
  • Section of abi.h: §I NBT binary, KvDb (thread-safe), system & server info
  • Position in the table: slot 62, counting from 0
  • Callers in each binding:

kvdb_set

C
bool (*kvdb_set)(PierKvDbHandle h, PierStr key, PierStr value);

Group note

KvDb: THREAD-SAFE (internal mutex). Paths are confined to the mod's own data directory; ".." and absolute paths are rejected. Handles are owned by the loader and force-closed (with a warning) at mod unload.

  • Call: api->kvdb_set(h, key, value)
  • Parameters:
    • h : PierKvDbHandle
    • key : PierStr
    • value : PierStr
  • Return type: bool
  • Section of abi.h: §I NBT binary, KvDb (thread-safe), system & server info
  • Position in the table: slot 63, counting from 0
  • Callers in each binding:

kvdb_del

C
bool (*kvdb_del)(PierKvDbHandle h, PierStr key);

Group note

KvDb: THREAD-SAFE (internal mutex). Paths are confined to the mod's own data directory; ".." and absolute paths are rejected. Handles are owned by the loader and force-closed (with a warning) at mod unload.

  • Call: api->kvdb_del(h, key)
  • Parameters:
    • h : PierKvDbHandle
    • key : PierStr
  • Return type: bool
  • Section of abi.h: §I NBT binary, KvDb (thread-safe), system & server info
  • Position in the table: slot 64, counting from 0
  • Callers in each binding:

kvdb_has

C
bool (*kvdb_has)(PierKvDbHandle h, PierStr key);

Group note

KvDb: THREAD-SAFE (internal mutex). Paths are confined to the mod's own data directory; ".." and absolute paths are rejected. Handles are owned by the loader and force-closed (with a warning) at mod unload.

  • Call: api->kvdb_has(h, key)
  • Parameters:
    • h : PierKvDbHandle
    • key : PierStr
  • Return type: bool
  • Section of abi.h: §I NBT binary, KvDb (thread-safe), system & server info
  • Position in the table: slot 65, counting from 0
  • Callers in each binding:

kvdb_is_empty

C
bool (*kvdb_is_empty)(PierKvDbHandle h);

Group note

KvDb: THREAD-SAFE (internal mutex). Paths are confined to the mod's own data directory; ".." and absolute paths are rejected. Handles are owned by the loader and force-closed (with a warning) at mod unload.

  • Call: api->kvdb_is_empty(h)
  • Parameters:
    • h : PierKvDbHandle
  • Return type: bool
  • Section of abi.h: §I NBT binary, KvDb (thread-safe), system & server info
  • Position in the table: slot 66, counting from 0
  • Callers in each binding:

kvdb_iter

C
void (*kvdb_iter)(PierKvDbHandle h, void* ctx, PierKvSink sink);

Group note

KvDb: THREAD-SAFE (internal mutex). Paths are confined to the mod's own data directory; ".." and absolute paths are rejected. Handles are owned by the loader and force-closed (with a warning) at mod unload.

  • Call: api->kvdb_iter(h, ctx, sink)
  • Parameters:
    • h : PierKvDbHandle
    • ctx : void*
    • sink : PierKvSink
  • Section of abi.h: §I NBT binary, KvDb (thread-safe), system & server info
  • Position in the table: slot 67, counting from 0
  • Callers in each binding:

Types

PierBytesSink

C
typedef void (*PierBytesSink)(void* ctx, uint8_t const* data, size_t len);

Raw byte sink (binary NBT). Bytes valid only within the call frame.

PierKvSink

C
typedef void (*PierKvSink)(void* ctx, PierStr key, PierStr value);

Key/value sink (kvdb_iter). Views valid only within the call frame.

PierKvDbHandle

C
typedef void* PierKvDbHandle;

Opaque handle to an open key-value database owned by the loader.