Repository navigation
v0.2.0
Zefir 0.2.0 adds core, the execution context every Zefir module will share.
core
zefir-core carries an operation's deadline, its cancellation token and its W3C trace identity through your code, without allocating, reading a clock or doing I/O.
Context: derive it withwithTrace,withDeadline(never extends a deadline) andwithCancellation;ctx.check(now)returnserror.Cancelledorerror.DeadlineExceeded.Deadlineon thestd.Io.Clock.awakeclock, with saturating arithmetic andtoTimeout()forstd.Iowaits.CancellationToken: an atomic, cooperative flag, safe to cancel from any thread.- W3C Trace Context:
TraceId,SpanId,TraceFlags,TraceState,TraceContext, andcore.w3cto parse and write thetraceparentandtracestateheaders for any transport, checked against the official W3C test suite. ErrorCode: the 16 canonical error classes of gRPC, Connect and Twirp, for transports to map to their own statuses.
See the core docs for passing contexts, ownership, cancellation rules for std.Io and the W3C headers.
confy is unchanged since v0.1.0. logger, rpc and orm are still placeholders without an API.
Requirements
Zig 0.17.0.
Installation
zig fetch --save git+https://github.com/vkiryakov/zefir#v0.2.0const zefir = b.dependency("zefir", .{ .target = target, .optimize = optimize });
// in your module's .imports:
.{ .name = "core", .module = zefir.module("zefir-core") },Until 1.0, breaking changes may happen in any minor release.