facet

repository·main·Indexed 25 days ago

https://github.com/facet-rs/facet

A comprehensive Rust ecosystem centered around reflection, providing tools for type metadata (SHAPE), safe value manipulation, high-performance serialization, and RPC systems. The repository includes the dibs Postgres toolkit for type-safe table definitions and migrations, the copypatch JIT substrate for executable memory and relocation patching, and support for the Styx DSL including a compliance suite and editor integrations.

Tokens
458.4K
Snippets
918
Records
2.3K
Agent score
81%

What's inside facet

  1. Overview of the dibs toolkit

    main

    dibs is a PostgreSQL toolkit for Rust built on two core pillars:

    1. Schema as Rust (facet): Your Rust types serve as the single source of truth for database tables, columns, and constraints.
    2. Queries as Styx: You write database queries using a specialized DSL (Styx). This provides LSP support and generates both typed Rust code and the corresponding SQL.

    Additionally, dibs generates migrations in Rust, allowing you to perform backfills and data fixes using the same mental model used for your application code.

  2. What is phon?

    main

    phon is a typed binary exchange format and execution engine designed primarily for Remote Procedure Calling (RPC). It enables programs in different languages to serialize and deserialize values while supporting schema evolution.

    Unlike purely self-describing formats (like JSON or CBOR) which are highly observable but wasteful, or purely compact formats (like raw binary structs) which are efficient but fragile, phon uses a schema-based approach. This allows for both observability and compatibility (forwards and backwards) without requiring explicit field numbering.

    Key design principles:

    • Two modes: It supports both a self-describing mode (for bootstrapping and dynamic values) and a compact mode (for efficient, schema-known exchanges).
    • Decoupled representation: It assumes the wire representation is different from the runtime memory representation to ensure consistent performance across different programming languages.
    • Schema-driven decoding: Implementations can optimize performance by generating "decoder programs" based on the remote schema and local runtime descriptors.
  3. Overview of @bearcove/phon-schema

    main

    The @bearcove/phon-schema package provides the TypeScript representation of Phon schemas and dynamic values. It serves as the shared contract used by the Phon compact engine, codegen output, and conformance tests.

    Key capabilities include:

    • Phon schema model types and schema registry helpers.
    • Support for encoding and decoding dynamic Value types.
    • Parsing for self-describing schemas and values.
    • Wire primitives including readers, byte sinks, tags, and hex helpers.
    • Schema validation and analysis for alignment and minimum size.
  4. Overview of facet-macro-parse

    main
    facet-macro-parse is a parser designed for use within facet derive macros. It acts as a bridge between raw procedural macro input and structured code generation by taking a TokenStream from a derive macro invocation and converting it into parsed type representations defined in the facet-macro-types crate. This allows developers to work with a structured AST (Abstract Syntax Tree) rather than raw tokens when implementing or extending facet's derive macros.
  5. Overview of vox-macros-core

    main

    vox-macros-core is the internal code generation engine used by the Vox service procedural macro system. It provides the shared macro expansion logic and token generation required to create clients, dispatchers, and service detail artifacts.

    Note that this crate is primarily internal infrastructure used by the service-definition layer and is designed to work in conjunction with:

    • vox-service-macros: The public procedural macro crate.
    • vox-macros-parse: The grammar and parser front-end.
  6. Overview of picante

    main

    picante is an async incremental query runtime for Rust. It is designed for Tokio-first pipelines and is inspired by the Salsa query system. It provides a framework for managing data dependencies and incremental computation through several core features:

    • Inputs: Defining the base data for the query system.
    • Interning: Efficiently managing unique values.
    • Async Derived Queries: Computing new data from inputs asynchronously.
    • Dependency Tracking: Automatically managing the relationships between queries.
    • Cache Persistence: Saving and loading the query state using facet and facet-postcard.
    • Observability: Tools for debugging the query graph and performance.
  7. Overview of @bearcove/vox-tcp

    main

    The @bearcove/vox-tcp package provides a TCP transport binding for the Vox ecosystem in TypeScript. It implements the Link layer using Node.js TCP streams, enabling network communication for Vox-based applications.

    Key capabilities include:

    • Framing and transport adapter logic specifically designed for TCP links.
    • Seamless integration with @bearcove/vox-core connection and runtime abstractions.
    • Compatibility with @bearcove/vox-wire for handling protocol payloads.
  8. Overview of the vox-types crate

    main

    The vox-types crate provides the shared protocol and runtime data model used across the entire Vox stack. It defines the core message and control types that allow different layers of the system to communicate.

    Key components include:

    • Wire-level and runtime enums/structs: The fundamental building blocks of the Vox protocol.
    • Request/Response and Channel types: Types used for managing communication flows and channels.
    • Error and Metadata types: Common types consumed by both the runtime and various transport implementations.