Python stable · Mojo preview

Cấu hình CoAkka Runtime · Python + Mojo

Python chiếu contract chung qua wheel stable. Mojo là source preview qua packaged C shim và không dùng API Python hay tự nhận cùng support scope.

Package và lifecyclecoakka-runtime-python==3.3.2
Interpreter
GIL-enabled CPython 3.11+. Dùng virtual environment riêng cho app.
RuntimeHost.start(start_spec=...)
Entry point mới được ưu tiên. ConnectorOrchestrator chỉ là tên compatibility.
Một host/process
Một active runtime host trong một Python process; context manager đóng reader, workers và native owner.
Bytes handler
Chạy đồng bộ trên request-reader turn và phải trả nhanh. Typed handlers dùng bounded Python worker queue.
take_background_error()
Chuyển giao lỗi worker chưa nhận; đó là diagnostic Python, không phải Core delivery outcome.
Startup intentConnectorStartSpec
system_name
Tên logical system/app-host.
node_id
Identity duy nhất của runtime owner trong system.
routes
Snapshot route generation đầu tiên; local-first dùng local_route.
queue_capacity=None
Giữ omission; Core chọn bound và báo ở startup config.
strict_no_drop=True
Explicit safe intent của frozen base ABI, không phải default do Python đoán.
generation
Generation của control snapshot; stale update bị từ chối.
enable_monitor=None
Omitted chọn Core default OFF; False là explicit off; True cho collection trước startup.
network=None
Omitted để Core chọn Embedded và giữ explicitPolicy=false.
Network, route và endpointRuntimeNetworkConfig · RouteSpec
embedded()
Local-only, không listener.
outbound_only()
Cho gọi remote routes mà không mở listener.
network_node(bind_host, bind_port, advertise_host, advertise_port)
Bind và advertise là facts khác nhau; production không advertise loopback cho máy khác.
RouteSpec.target
Business address giữ ổn định khi handler chuyển process.
endpoints
Danh sách candidate có host, port, weight và flags.
SINGLE_OWNER
Một owner; WEIGHTED_ROUND_ROBIN dùng weight; RENDEZVOUS_HASH dùng route key ổn định.
weight
Trọng số tương đối, không phải retry count, priority hay phần trăm.

Tra routing chung · Tra failover/retry

Kết nối và securityRuntimeTcpConnectionStrategySpec · RuntimeTcpSecuritySpec
connection_strategy=None
Omit toàn group để Core chọn AUTO/current MULTIPLEXING.
mode
Object đã có field/tuning phải có explicit mode; enum zero là PER_EXCHANGE, không phải AUTO.
max_connections
Bound connection khi mode/capability áp dụng.
max_requests_per_connection
Bound request trước retire.
idle_timeout_ms
Bound connection rảnh.
security.mode
PLAINTEXT/TLS/MUTUAL_TLS; Core 3.3 bundled hiện không cung cấp public TCP TLS/mTLS.
credential_generation
Positive, tăng dần khi reload cùng mode.
credential_id
Non-secret diagnostic ID.
CA/cert/key paths
App sở hữu file/permission/rotation; snapshot không trả secret path/material.

Tra connection và TLS/mTLS contract.

File Lane và Stream LaneOwner độc lập
FileLane.open_owned
Receiver exact owner cấp FileReceiveGrant.
FileLane.sha256
Tính exact size/digest qua Core trước prepare.
wait_transfer
Tiếp tục từ update sequence; success cần terminal + COMPLETED + OK ở hai peer.
StreamLane.open_owned
Publisher cấp single-admission grant.
max_frame_bytes
Bound mỗi frame; public maximum hiện 4 MiB.
initial_window_bytes
Receive credit ban đầu, phải chứa ít nhất một max frame.
memoryview
Chỉ borrow trong callback; copy trước khi retain.
close()
Gọi từ external owner sau callback/wait, không gọi reentrant từ worker callback.

Tra data-lane lifecycle và failures.

Đọc Core accepted/effective statestartup · config · network · capabilities

Tạo configuration.py, dán source và chạy trong virtual environment.

configuration.py
from coakka_v2_connector import ConnectorStartSpec, RuntimeHost, local_route


target = "orders.quote"
start_spec = ConnectorStartSpec(
    system_name="orders",
    node_id="config-python-1",
    routes=[local_route(target)],
    enable_monitor=True,
)

with RuntimeHost.start(start_spec=start_spec) as runtime:
    startup = runtime.runtime_startup_config()
    config = runtime.runtime_config()
    network = runtime.runtime_network_config()
    print(
        f"generation={config['appliedGeneration']} "
        f"queue_capacity={startup['queueCapacity']} "
        f"strict_no_drop={str(startup['strictNoDrop']).lower()} "
        f"monitor={str(startup['monitor']['enabled']).lower()} "
        f"network_mode={network['mode']}"
    )
Terminal
python configuration.py

Kết quả đã kiểm chứng

generation=1 queue_capacity=4096 strict_no_drop=true monitor=true network_mode=1
runtime_startup_config()
Default groups, queue, execution, connection, I/O, Monitor và delivery facts.
runtime_config()
Applied generation, route count, runtime state và overload facts.
runtime_network_config()
Mode, explicit policy, bind và advertise.
runtime_capabilities()
Compiled/entitled/effective features trước advanced transport.

Đối chiếu requested, accepted, effective và observed.

Mojo previewsource 3.3.1 · toolchain pinned
Toolchain
1.0.0b2.dev2026052115; compiler khác chưa nằm trong evidence.
Application API
Chưa ổn định. Mojo executable gọi C shim; shim sở hữu lifecycle và Core ask owner.
Archive
SHA-256 a9b1a9cc78086d92d81294f7c1efa7e42c510f81df115d3830545bf5f143e5c1.
Qualified execution
macOS ARM64 và Raspberry Pi 5 Linux ARM64. TLS chưa được exercise.

Copy lệnh và chạy exact archive smoke.