Skip to main content
Protocol 1 is the original VEF interface. It was stable as of v0.0.1 and remains supported, but is likely to be deprecated in a future release. New extensions should use the Protocol 3 API — the template-based type builders in the Creating Extensions in C++ and C++ Development guides. This page exists for reference when working with existing extensions built against Protocol 1.

Function-Pointer Type API

Protocol 1 custom types are registered using explicit function pointers instead of the vsql::make_type<> template. The function signatures differ from the Protocol 3 equivalents — they take raw pointers and lengths rather than Arg and Result objects.

Function Signatures

Registration

This form requires #include <villagesql/extension.h> (not <villagesql/vsql.h>) and using namespace villagesql;.
vsql::make_type<kMyTypeName>() (with a compile-time string NTTP) is the preferred form. make_type(MYTYPE) (no template parameter) is the Protocol 1 form — it remains supported but is likely to be deprecated in a future release.

Raw ABI Style (Functions)

Protocol 1 VDF implementations can pass the raw C structs directly instead of using typed wrappers. This style remains supported but is likely to be deprecated in a future release — use the typed argument/result API for all new code.
This per-argument raw signature — void(vef_context_t*, vef_invalue_t* arg0, ..., vef_vdf_result_t*) — is only detected by make_func<>() from <villagesql/extension.h>. The make_func<>() from <villagesql/vsql.h> rejects any raw vef_context_t*/vef_invalue_t*/vef_vdf_result_t* signature at compile time.

Result Constants

The raw ABI communicates result state via vef_return_value_type_t set on result->type: In Protocol 3, out.set(), out.set_null(), out.warning(), and out.error() handle this automatically.

Aggregate Registration in Protocol 1

There is no raw ABI aggregate registration path. make_func<>() has no .clear<>() or .accumulate<>() member — those methods exist only on the separate make_aggregate_func<State, &result_fn>() builder from <villagesql/vsql.h>, which uses State&-based typed signatures rather than raw vef_context_t*/vef_vdf_args_t* pointers. Even a Protocol 1 extension must register aggregates this way. Use the typed aggregate approach for all new code.