pit

Account Group Id

Back to index

OpenPitParamAccountGroupId

Stable account-group identifier type for FFI payloads.

WARNING: Use exactly one account-group-id source model per runtime:

Do not mix both models in the same runtime state. A hashed string value can coincide with a direct numeric ID, collapsing two distinct groups into one key.

typedef uint32_t OpenPitParamAccountGroupId;

OpenPitParamAccountGroupIdOptional

typedef struct OpenPitParamAccountGroupIdOptional {
    OpenPitParamAccountGroupId value;
    bool is_set;
} OpenPitParamAccountGroupIdOptional;

OPENPIT_DEFAULT_ACCOUNT_GROUP

The reserved default account-group identifier. Every account belongs to this group until it is registered into another one, so no constructor may produce it. Mirrors openpit::param::DEFAULT_ACCOUNT_GROUP.

#define OPENPIT_DEFAULT_ACCOUNT_GROUP ((OpenPitParamAccountGroupId) 0)

openpit_create_param_account_group_id_from_uint32

Constructs an account-group identifier from a 32-bit integer.

This is a direct numeric mapping with no collision risk.

The value 0 is reserved for the default account group (OPENPIT_DEFAULT_ACCOUNT_GROUP) and is rejected: every account already belongs to that group implicitly, so no external input may name it.

WARNING: Do not mix IDs produced by this function with IDs produced by openpit_create_param_account_group_id_from_string in the same runtime state.

Contract:

Safety

out must be either null or a valid writable pointer.

bool openpit_create_param_account_group_id_from_uint32(
    uint32_t value,
    OpenPitParamAccountGroupId * out,
    OpenPitOutError out_error
);

openpit_create_param_account_group_id_from_string

Constructs an account-group identifier from a UTF-8 byte sequence using FNV-1a 32-bit hashing.

The bytes are read only for the duration of the call. No trailing zero byte is required.

Collision note:

WARNING: Do not mix IDs produced by this function with IDs produced by openpit_create_param_account_group_id_from_uint32 in the same runtime state.

Contract:

Safety

value.ptr must be non-null and point to at least value.len readable UTF-8 bytes when value.len > 0.

bool openpit_create_param_account_group_id_from_string(
    OpenPitStringView value,
    OpenPitParamAccountGroupId * out,
    OpenPitOutError out_error
);