data.drivers._pelt._transport

Page actions AI-ready formats and sharing
Open LLM text
Share with AI
Ask Claude Ask ChatGPT Ask Gemini Ask Copilot

anyio I/O edge for pelt: sockets, recv buffer, TLS, session handshake (epic E4).

Only this module (and laterconnection / poolin E5) touches anyio. The sans-I/O SimpleQueryProtocolengine is driven against…

anyio I/O edge for pelt: sockets, recv buffer, TLS, session handshake (epic E4).

Only this module (and laterconnection / poolin E5) touches anyio. The sans-I/O SimpleQueryProtocol engine is driven against a PGStream— bytes read from the socket are appended to a reusableRecvBuffer, fed to receive_bytes(), and frontend bytes from the engine are written back. Never hold a lock acrossawait; per-connection state is single-owner on one task.

data.drivers._pelt._transport

Name Type Default Description
type
qualified_name
element_type
description
source_file
line_number
is_autodoc
autodoc_element
_autodoc_template
_autodoc_url_path
_autodoc_page_type
title
doc_content_hash

Symbols on this page

RecvBuffer
class

Per-connection reusable inbound buffer with zero-copymemoryviewreads.

Consumed prefix bytes are deleted immediately; when the unused tail is small but the allocated buffer is large, compact by copying the tail to the front (same discipline as the protocol engine'sbytearraycarry-forward).

PGStream
class

A bidirectional Postgres wire stream with an inboundRecvBuffer.

PGSession
class

An authenticated, ready-for-query connection session.

open_stream
function async
async def open_stream(config: ConnectionConfig) -> PGStream

Open a TCP or Unix domain socket (no TLS yet).

Parameters

Name Type Default Description
config ConnectionConfig
negotiate_tls
function async
async def negotiate_tls(stream: PGStream, config: ConnectionConfig) -> PGStream

Apply libpq-compatible sslmode negotiation on an already-open stream.

Parameters

Name Type Default Description
stream PGStream
config ConnectionConfig
connect_session
function async
async def connect_session(config: ConnectionConfig) -> PGSession

Connect, negotiate TLS, run startup + auth, and return a ready session.

Parameters

Name Type Default Description
config ConnectionConfig
build_cancel_request
function
def build_cancel_request(*, pid: int, secret_key: int) -> bytes

Frontend CancelRequest (sent on a separate connection, no startup message).

Parameters

Name Type Default Description
pid int
secret_key int
cancel_backend_query
function async
async def cancel_backend_query(config: ConnectionConfig, *, pid: int, secret_key: int) -> None

Open a throwaway connection and send CancelRequest (best-effort).

Parameters

Name Type Default Description
config ConnectionConfig
pid int
secret_key int

View source · /home/runner/work/chirp/chirp/site/../src/chirp/data/drivers/_pelt/_transport.py:1