• Stars
    star
    116
  • Rank 294,397 (Top 6 %)
  • Language
    Zig
  • License
    MIT License
  • Created over 3 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Async I/O for Zig

pike

A minimal cross-platform high-performance async I/O library written in Zig.

Features

  • Reactor/proactor-based I/O notification support
    • epoll (linux)
    • kqueue (darwin)
    • i/o completion ports (windows)
  • Async POSIX socket support
    • bind, listen, connect, accept
    • read, recv, recvFrom
    • write, send, sendTo
    • get/set socket options
  • Async Windows socket support
    • bind, listen, connect, accept
    • read, recv, recvFrom
    • write, send, sendTo
    • get/set socket options
  • Async signal support
    • signalfd for epoll (linux)
    • EVFILT_SIGNAL for kqueue (darwin)
    • SetConsoleCtrlHandler for i/o completion ports (windows)
  • Async event support
    • sigaction (posix)
    • SetConsoleCtrlHandler (windows)

Design

Notifier

A Notifier notifies of the completion of I/O events, or of the read/write-readiness of registered file descriptors/handles.

Should a Notifier report the completion of I/O events, it is designated to wrap around a proactor-based I/O notification layer in the operating system such as I/O completion ports on Windows.

Should a Notifier report the read/write-readiness of registered file descriptors/handles, it is designated to wrap around a reactor-based I/O notification layer in the operating system such as epoll on Linux, or kqueue on Darwin-based operating systems.

The Notifier's purpose is to drive the execution of asynchronous I/O syscalls upon the notification of a reactor/proactor-based I/O event by dispatching suspended asynchronous function frames to be resumed by a thread pool/scheduler (e.g. kprotty/zap).

Handle

A Handle's implementation is specific to a Notifier implementation, though overall wraps around and represents a file descriptor/handle in a program.

Subject to the Notifier implementation a Handle's implementation falls under, state required to drive asynchronous I/O syscalls through a Handle is kept inside a Handle.

An example would be an intrusive linked list of suspended asynchronous function frames that are to be resumed upon the recipient of a notification that a file descriptor/handle is ready to be written to/read from.

More Repositories

1

flatend

Quickly build microservices using p2p networking in NodeJS/Go.
TypeScript
648
star
2

rheia

A blockchain written in Zig.
Zig
240
star
3

quickjs

Go bindings to QuickJS: a fast, small, and embeddable ES2020 JavaScript interpreter.
C
146
star
4

reliable

A reliability layer for UDP connections in Go.
Go
138
star
5

monte

The bare minimum for high performance, fully-encrypted bidirectional RPC over TCP in Go with zero memory allocations.
Go
117
star
6

alon

Remix for Solana.
JavaScript
99
star
7

casso

A Go implementation of the Cassowary constraint solving algorithm.
Go
75
star
8

youtube

A library for executing search queries, retrieving metadata, and obtaining direct links to video-only/audio-only/muxed versions of videos on YouTube in Go.
Go
62
star
9

lmdb-zig

Lightweight, fully-featured, idiomatic cross-platform Zig bindings to Lightning Memory-Mapped Database (LMDB).
Zig
62
star
10

hyperia

Zig
44
star
11

snow

A small, fast, cross-platform, async Zig networking framework built on top of lithdew/pike.
Zig
35
star
12

hello

Multi-threaded cross-platform HTTP/1.1 web server example in Zig.
Zig
32
star
13

solana-zig

Write Solana programs in Zig.
Zig
21
star
14

borsh-zig

A Zig implementation of the Borsh binary format specification.
Zig
16
star
15

cuckoo

A fast, vectorized Cuckoo filter implementation in Go. Zero allocations in hot paths with zero-copy binary representation.
Go
15
star
16

kademlia-go

S/Kademlia in Go. Heavy WIP.
Go
11
star
17

nicehttp

Helper utilities for downloading files/making requests with valyala/fasthttp.
Go
9
star
18

flatlang

An embeddable human-friendly configuration language with zero keywords in Go. Heavily inspired by Google Starlark and CUE.
Go
8
star
19

usockets-zig

A fork of uSockets packaged for Zig.
Zig
8
star
20

seq

A fast implementation of sequence buffers in Go with 100% unit test coverage.
Go
7
star
21

bincode-zig

A Zig implementation of the Bincode binary format specification.
Zig
7
star
22

oauth2-go

What does it take to write a minimal security-first OAuth 2.0 Server w/ OpenID Connect support in Go?
Go
6
star
23

bytesutil

Utilities for reducing memory allocations in Go w/ 100% unit test coverage.
Go
5
star
24

boringssl-zig

A fork of boringssl packaged for Zig.
Assembly
4
star
25

recaptcha

Quickly verify reCAPTCHA v2/v3 submissions in Go.
Go
4
star
26

libuv-zig

A fork of libuv packaged for Zig.
Zig
3
star
27

uwebsockets-zig

A fork of uWebSockets packaged for Zig.
Zig
2
star
28

rhh-ts

Robin-hood hashing vs. B+Trees in TypeScript.
TypeScript
2
star
29

asciigraph

Go package to make lightweight ASCII line graph ╭┈╯ in command line apps. Mindful fork of guptarohit/asciigraph.
Go
1
star
30

trpc

🧙‍♀️ Move Fast and Break Nothing. End-to-end typesafe APIs made easy.
TypeScript
1
star
31

ed25519-donna-zig

Minimal Zig bindings to ed25519-donna.
Zig
1
star
32

alon-sysroot

Sysroot for Alon.
C
1
star
33

sqlutil

Utilities for working with SQL in Go.
Go
1
star
34

slept

Research on reliable, high-peformance transport protocols for p2p networking.
Go
1
star