mirror of
https://github.com/zap-proto/zip.git
synced 2026-10-19 15:38:57 +00:00
An op is an async fn. It may take &zip::Cx (request headers; the answer's status, headers and trailers) and a zip::Body read as it arrives, and may answer zip::Sse or zip::Body, each chunk written as the op yields it. A client that leaves drops the op's stream. The blocking std::net door is gone: HTTP/1.1 keep-alive and h2c on one port (hyper_util auto), graceful shutdown bounded by a grace. The ZAP door runs on tokio and streams with zap-proto/http's head, data and end frames. Wire names are serde's: the derive reads rename, rename_all, skip and with, and the hand-rolled JSON is deleted. The info manifest comes out byte for byte as before. No zapgen emits Rust, so the crate never built; the frame codec is written in zap.rs and pinned to frames Go wrote. The length prefix is big-endian, as zap-proto/http's transport writes it. examples/stream is a JSON op, an SSE op with a trailer and a byte relay, tested over raw HTTP/1.1, h2c and ZAP sockets. Claude-Session: https://claude.ai/code/session_01SCPMGSQsLNF2YtHFL4bwyp
33 lines
1.2 KiB
Makefile
33 lines
1.2 KiB
Makefile
# The build, in the order the facts become available.
|
|
#
|
|
# The macro compiles what it read into the crate, and the binary prints it. So
|
|
# the manifest describes THIS build — there is no file beside the source to fall
|
|
# out of step, and no way to project a service that no longer exists.
|
|
#
|
|
# It is two steps and not a build script because the description exists only
|
|
# after a compile. What zipc writes is checked in beside the source, the way a
|
|
# generated file is anywhere else, so a fresh clone builds without either tool.
|
|
#
|
|
# make gen compile, project, and compile again against the projections
|
|
# make run serve on the default addresses
|
|
# make check the doors answer, and the wire is ZAP
|
|
|
|
# gen names a directory as well as a step, and the step is the one meant.
|
|
.PHONY: gen run check
|
|
|
|
# zipc is this checkout's, so the documents are projected by the projector
|
|
# the manifest was written for.
|
|
ZIPC ?= go run ../../../cmd/zipc
|
|
ROOT := ../..
|
|
|
|
gen:
|
|
cd $(ROOT) && cargo run -q -p stream -- --manifest > examples/stream/gen/manifest.json
|
|
$(ZIPC) -out gen -package stream gen/manifest.json
|
|
cd $(ROOT) && cargo build -p stream
|
|
|
|
run:
|
|
cd $(ROOT) && cargo run -p stream
|
|
|
|
check:
|
|
cd $(ROOT) && cargo test -p stream
|