Skip to content

Latest commit

 

History

History
79 lines (53 loc) · 2.32 KB

File metadata and controls

79 lines (53 loc) · 2.32 KB

Hugo Documentation

Welcome to Hugo, a library bringing Go-style concurrency primitives and functional result pipelines to .NET 10.

Quick Links

What is Hugo?

Hugo provides:

  • Go-inspired primitives: WaitGroup, Mutex, RwMutex, channels, and select operations
  • Railway-oriented programming: Result<T> pipelines with functional combinators
  • Deterministic workflows: Replay-safe orchestration with version gates and effect stores
  • Observability: Built-in OpenTelemetry integration with schema-aware metrics
  • Task queues: Cooperative leasing with heartbeats and automatic requeuing

Documentation Structure

Learning-oriented guides that teach Hugo concepts through hands-on examples.

Task-oriented recipes for specific scenarios like fan-in workflows, retry policies, and observability setup.

Comprehensive API documentation including concurrency primitives, result pipelines, and diagnostics.

Understanding-oriented discussions about design decisions and architectural principles.

Installation

dotnet add package Hugo
dotnet add package Hugo.Diagnostics.OpenTelemetry

Example

using Hugo;
using static Hugo.Go;

var channel = MakeChannel<string>(capacity: 10);
var workers = new WaitGroup();

workers.Go(async () =>
{
    using var _ = Defer(() => channel.Writer.TryComplete());
    await channel.Writer.WriteAsync("hello", cancellationToken);
});

await foreach (var value in channel.Reader.ReadAllAsync(cancellationToken))
{
    var result = Ok(value)
        .Ensure(text => !string.IsNullOrWhiteSpace(text))
        .Map(text => text.ToUpperInvariant());

    if (result.IsSuccess)
        Console.WriteLine(result.Value);
}

await workers.WaitAsync(cancellationToken);

Support