ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
Loading...
Searching...
No Matches
kcmcp Namespace Reference

Classes

struct  ProtocolError
 Thrown by Connection on a protocol violation that warrants an ERROR frame (e.g. More...
struct  Message
 A fully reassembled inbound message (MORE frames concatenated). More...
struct  Request
 Decoded REQUEST payload. More...
class  Connection
 Framed message transport over one connected socket fd. More...

Enumerations

enum class  Type : uint8_t {
  HELLO = 0x00 , REQUEST = 0x01 , RESULT = 0x02 , ERROR = 0x03 ,
  PROGRESS = 0x04 , CANCEL = 0x05 , PING = 0x06 , PONG = 0x07 ,
  BYE = 0x08
}
 Frame type (header byte 0). More...
enum  Flag : uint8_t { FLAG_MORE = 0x01 , FLAG_COMPRESSED = 0x02 }
 Frame flags (header byte 1). More...
enum class  Operation : uint8_t { COUNT = 0 , WMC = 1 , COMPILE = 2 }
 Operation registry (REQUEST byte 0 / HELLO operations names). More...
enum class  InputFormat : uint8_t { DIMACS_CNF = 0 , CIRCUIT_BCS12 = 1 }
 Input-format registry (REQUEST byte 1). More...
enum class  OutputFormat : uint8_t {
  DECIMAL = 0 , RATIONAL = 1 , DOUBLE = 2 , BIGINT = 3 ,
  DDNNF_NNF = 4
}
 Output-format registry (REQUEST byte 2 / RESULT byte 0; one shared space). More...
enum class  ErrorCode : uint16_t {
  UNSUPPORTED_OPERATION = 1 , UNSUPPORTED_FORMAT = 2 , PARSE = 3 , TIMEOUT = 4 ,
  CANCELLED = 5 , INTERNAL = 6 , PAYLOAD_TOO_LARGE = 7 , UNSUPPORTED_VERSION = 8 ,
  COMPRESSION_UNSUPPORTED = 9
}
 ERROR codes. More...

Functions

const char * operation_name (Operation op)
const char * input_format_name (InputFormat fmt)
const char * output_format_name (OutputFormat fmt)
bool parse_request (const std::string &payload, Request &out)
 Decode a REQUEST payload; returns false if structurally malformed.
std::string build_result (OutputFormat fmt, const std::string &meta_json, const std::string &result)
 Build a RESULT payload (result_format byte + meta JSON + result bytes).
std::string build_error (ErrorCode code, const std::string &message)
 Build an ERROR payload (u16 code + UTF-8 message).

Enumeration Type Documentation

◆ ErrorCode

enum class kcmcp::ErrorCode : uint16_t
strong

ERROR codes.

Enumerator
UNSUPPORTED_OPERATION 

unsupported operation or unknown frame type

UNSUPPORTED_FORMAT 
PARSE 
TIMEOUT 
CANCELLED 
INTERNAL 
PAYLOAD_TOO_LARGE 
UNSUPPORTED_VERSION 

client requires a KCMCP major this server lacks

COMPRESSION_UNSUPPORTED 

COMPRESSED frame flag set, but unsupported.

Definition at line 51 of file kcmcp_protocol.h.

◆ Flag

enum kcmcp::Flag : uint8_t

Frame flags (header byte 1).

Enumerator
FLAG_MORE 

payload continues in the next frame

FLAG_COMPRESSED 

payload is zstd-compressed (unused here)

Definition at line 35 of file kcmcp_protocol.h.

◆ InputFormat

enum class kcmcp::InputFormat : uint8_t
strong

Input-format registry (REQUEST byte 1).

Enumerator
DIMACS_CNF 
CIRCUIT_BCS12 

Definition at line 44 of file kcmcp_protocol.h.

◆ Operation

enum class kcmcp::Operation : uint8_t
strong

Operation registry (REQUEST byte 0 / HELLO operations names).

Enumerator
COUNT 
WMC 
COMPILE 

Definition at line 41 of file kcmcp_protocol.h.

◆ OutputFormat

enum class kcmcp::OutputFormat : uint8_t
strong

Output-format registry (REQUEST byte 2 / RESULT byte 0; one shared space).

Enumerator
DECIMAL 
RATIONAL 
DOUBLE 
BIGINT 
DDNNF_NNF 

Definition at line 47 of file kcmcp_protocol.h.

◆ Type

enum class kcmcp::Type : uint8_t
strong

Frame type (header byte 0).

Enumerator
HELLO 
REQUEST 
RESULT 
ERROR 
PROGRESS 
CANCEL 
PING 
PONG 
BYE 

Definition at line 22 of file kcmcp_protocol.h.

Function Documentation

◆ build_error()

std::string kcmcp::build_error ( ErrorCode code,
const std::string & message )

Build an ERROR payload (u16 code + UTF-8 message).

Definition at line 210 of file kcmcp_protocol.cpp.

◆ build_result()

std::string kcmcp::build_result ( OutputFormat fmt,
const std::string & meta_json,
const std::string & result )

Build a RESULT payload (result_format byte + meta JSON + result bytes).

Definition at line 196 of file kcmcp_protocol.cpp.

◆ input_format_name()

const char * kcmcp::input_format_name ( InputFormat fmt)

Definition at line 26 of file kcmcp_protocol.cpp.

◆ operation_name()

const char * kcmcp::operation_name ( Operation op)

Definition at line 16 of file kcmcp_protocol.cpp.

◆ output_format_name()

const char * kcmcp::output_format_name ( OutputFormat fmt)

Definition at line 35 of file kcmcp_protocol.cpp.

◆ parse_request()

bool kcmcp::parse_request ( const std::string & payload,
Request & out )

Decode a REQUEST payload; returns false if structurally malformed.

Definition at line 179 of file kcmcp_protocol.cpp.