Skip to content

v0.2.0

Choose a tag to compare

@vkiryakov vkiryakov released this 10 Oct 07:01
0288558

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 with withTrace, withDeadline (never extends a deadline) and withCancellation; ctx.check(now) returns error.Cancelled or error.DeadlineExceeded.
  • Deadline on the std.Io.Clock.awake clock, with saturating arithmetic and toTimeout() for std.Io waits.
  • CancellationToken: an atomic, cooperative flag, safe to cancel from any thread.
  • W3C Trace Context: TraceId, SpanId, TraceFlags, TraceState, TraceContext, and core.w3c to parse and write the traceparent and tracestate headers 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.0
const 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.