odyssey/third_party/kiwi
Dmitry Simonenko 6c0a1f09f8 odyssey: major rework of io architecture
This patch intend is to improve overall io performance, reduce
cpu and system usage.

Machinarium:

IO read/write logic is highly simplified and now based on conditions
instead of previously made internal readahead buffer and msg
queues. This allows to give user more control over io operations and
avoid doing undesired readahead copying.

Above that, TLS implementation reworked to use async logic instead of
separate BIO layer.

Direct pooling functions removed.

New objects machine_cond_t and machine_iov_t objects.

Odyssey:

Introduced readahead, io and relay objects.

Relay allows to connect two io handles for direct data retransmission
without double copying.

Removed configuration options no longer needed:
packet_read_size, packet_write_queue
2019-01-23 18:43:52 +03:00
..
kiwi odyssey: major rework of io architecture 2019-01-23 18:43:52 +03:00
CMakeLists.txt kiwi: import implementation 2018-08-23 16:17:15 +03:00
README.md kiwi: add README.md 2018-08-23 16:21:39 +03:00
kiwi.h odyssey: major parameter settings optimization 2018-12-12 16:07:25 +03:00

README.md

Kiwi

PostgreSQL protocol-level C library.

Library is designed to provide most of the functionality needed to write or read PostgreSQL protocol messages. Both Frontend (client to server) and Backend (server to client) messages are supported, making it possible to write client or server simulation applications.

No network part is supported. Only buffer management and packet validation.

Library is intedend to work in pair with the machinarium framework.

PostgreSQL packet readers

/* Read initial message (StartupMessage, CancelRequest, SSLRequest) */
kiwi_read_startup()

/* Read any other PostgreSQL packet */
kiwi_read()

FRONTEND

Write messages to Backend

/* StartupMessage */
kiwi_fe_write_startup_message()

/* CancelRequest */
kiwi_fe_write_cancel()

/* SSLRequest */
kiwi_fe_write_ssl_request()

/* Terminate */
kiwi_fe_write_terminate()

/* PasswordMessage */
kiwi_fe_write_password()

/* Query */
kiwi_fe_write_query()

/* Parse */
kiwi_fe_write_parse()

/* Bind */
kiwi_fe_write_bind()

/* Describe */
kiwi_fe_write_describe();

/* Execute */
kiwi_fe_write_execute();

/* Sync */
kiwi_fe_write_sync();

Read messages from Backend

/* ReadyForQuery */
kiwi_fe_read_ready();

/* BackendKeyData */
kiwi_fe_read_key();

/* Authentication messages */
kiwi_fe_read_auth();

/* ParameterStatus */
kiwi_fe_read_parameter();

/* ErrorResponse */
kiwi_fe_read_error();

BACKEND

Write messages to Frontend

/* ErrorResponse */
kiwi_be_write_error()
kiwi_be_write_error_fatal()
kiwi_be_write_error_panic()

/* NoticeResponse */
kiwi_be_write_notice()

/* AuthenticationOk */
kiwi_be_write_authentication_ok()

/* AuthenticationCleartextPassword */
kiwi_be_write_authentication_clear_text()

/* AuthenticationMD5Password */
kiwi_be_write_authentication_md5()

/* BackendKeyData */
kiwi_be_write_backend_key_data()

/* ParameterStatus */
kiwi_be_write_parameter_status()

/* EmptyQueryResponse */
kiwi_be_write_empty_query()

/* CommandComplete */
kiwi_be_write_complete()

/* ReadyForQuery */
kiwi_be_write_ready()

/* ParseComplete */
kiwi_be_write_parse_complete()

/* BindComplete */
kiwi_be_write_bind_complete()

/* PortalSuspended */
kiwi_be_write_portal_suspended()

/* NoData */
kiwi_be_write_no_data()

/* RowDescription */
kiwi_be_write_row_description()
kiwi_be_write_row_description_add()

/* DataRow */
kiwi_be_write_data_row()
kiwi_be_write_data_row_add()

Read messages from Frontend

/* Read StartupMessage, CancelRequest or SSLRequest */
kiwi_be_read_startup();

/* PasswordMessage */
kiwi_be_read_password();