Skip to content

API Reference

The Rapp ecosystem is designed to be minimal and easy to understand. It integrates natively with .NET constructs using only a few custom attributes and options classes.

Attributes

[RappCache]

The foundational attribute that instructs the Rapp Source Generator to analyze the partial class and generate static binary serialization matching the schema.

csharp
[RappCache]
public partial class UserProfile
{
    public Guid Id { get; set; }
    public string Name { get; set; }
}

Details:

  • Validates the class schema.
  • Emits cryptographic validation checksums based on fields to protect against breaking deployment changes.
  • Requires the class to be declared as partial.

[RappGhost]

Instructs the Source Generator to create a high-performance "Ghost Reader" struct designed for Zero-Allocation, Zero-Copy data reads.

csharp
[RappGhost]
public partial class HighSpeedTick
{
    public double Price { get; set; }
    public long Timestamp { get; set; }
}

Details:

  • See the Ghost Reader Guide for full implementation details.
  • Useful for edge, AI, and low-latency trading contexts where data extraction shouldn't trigger GC pressure.

Interfaces and Extensibility

IRappCacheSerializer

The core internal interface mapping types to their MemoryPack binary buffers, protected by Rapp schema hashing. Note: Directly implementing this is generally unnecessary because it is automatically generated by [RappCache].

csharp
public interface IRappCacheSerializer<T>
{
    string SchemaHash { get; set; }
    void Serialize(ref MemoryPackWriter writer, ref T? value);
    void Deserialize(ref MemoryPackReader reader, ref T? value);
}

Options Configuration

Telemetry Settings

While Rapp compiles extremely tight byte-streams, you can enable runtime MSBuild configurations to track caching efficacy metrics.

When the RAPP_TELEMETRY define constant is applied to the .csproj, the RappInterceptor hooks into the .NET System.Diagnostics.Metrics libraries, exposing the following observable quantities:

  • rapp_cache_hits_total: Counter measuring complete deserialization requests successfully pulled from memory.
  • rapp_cache_misses_total: Counter measuring invalid schema/hash mismatch dropouts that required fallback DB re-fetches.

Released under the MIT License.