ActualLab.Fusion

repository·master·Indexed 41 days ago

https://github.com/actuallab/fusion

A middleware layer for .NET applications providing real-time state synchronization, automatic cache invalidation, and efficient RPC. It enables features like offline support and real-time updates via lazy computation and dependency tracking, supporting Blazor Server, WebAssembly, and MAUI.

Tokens
367.5K
Snippets
742
Records
1.5K
Agent score
52%

What's inside Fusion

  1. Overview of Fusion TypeScript packages

    master

    The TypeScript port of Fusion is designed to be lighter than the .NET version, focusing on client-side consumption of server-side compute services. The following packages are available:

    • @actuallab/core: Provides core utilities like Result, AsyncContext, AsyncLock, PromiseSource, events, and retry logic.
    • @actuallab/rpc: Handles RPC communication via RpcHub, RpcClientPeer, RpcStream, and WebSocket transport.
    • @actuallab/fusion: Contains the core reactive primitives: Computed<T>, @computeMethod, ComputedState, and MutableState.
    • @actuallab/fusion-rpc: Provides FusionHub, which is a compute-aware RPC implementation that propagates invalidations.
    • @actuallab/fusion-react: Provides React hooks for reactive state: useComputedState and useMutableState.
  2. Overview of ActualLab.Fusion capabilities

    master

    ActualLab.Fusion provides a comprehensive suite of tools for building reactive, real-time applications:

    • Compute & Caching: Manages compute services, computed values, dependency graphs, and memory management.
    • Reactive UI: Provides ComputedState<T>, snapshots, and Blazor components for handling loading and error states.
    • ActualLab.Rpc: A reconnectable RPC layer supporting routing, streaming, serialization, and remote compute services.
    • CommandR & Operations Framework: Handles command pipelines, transactional operation logs, distributed invalidation, and transient-error reprocessing.
    • Data Integration: Includes Authentication, Entity Framework integration (database hubs, batching, sharding), and session-aware APIs.
    • Core Utilities: @actuallab/core provides concurrency, caching, collections, and worker abstractions.
    • TypeScript Support: Full ports of Core, Fusion, RPC, Fusion RPC, and React integration layers for frontend development.
  3. Overview of ActualLab.Rpc

    master
    ActualLab.Rpc is a high-performance RPC protocol specifically designed for .NET environments. While it powers the distributed state management of Fusion, it can be used independently. It is optimized for low latency and high throughput, supporting both ordinary request-response calls and native streaming. The protocol is AOT-friendly, making it suitable for environments like MAUI where a full runtime is not available.
  4. Overview of ActualLab.Fusion.Ext.Contracts

    master

    ActualLab.Fusion.Ext.Contracts provides the client-side components for the Fusion framework. Fusion is a new implementation of "computed observables" specifically designed for distributed applications.

    Key characteristics of the client-side components include:

    • Thread-safe: Safe for use in multi-threaded environments.
    • Asynchronous: Built to handle non-blocking operations.
    • Immutable: Ensures state consistency.
    • Distributed-ready: Designed to serve replicas of computed instances to remote clients, enabling real-time state synchronization.
  5. Overview of Fusion Library Audit findings

    master

    The Fusion Library Audit identifies several critical categories of defects across the ecosystem. Developers should be aware of these risk areas when working with the following clusters:

    • RPC & Security: Potential authorization bypasses (e.g., dispatching methods before handshake validation), tenant/user isolation failures (e.g., raw prefix matching for namespaces), and security-relevant redirect/session handling issues.
    • Process Stability: Risks of process crashes, hangs, or DoS (e.g., unbounded WebSocket messages or synchronous disposal failures).
    • Data Integrity: Risks of silent data loss or corruption (e.g., ring-buffer item drops or corrupted hash-key semantics).
    • Lifecycle & Completion: Issues where operations or cleanups exit before required work is successfully completed.
    • Framework State: Risks involving invalidation integrity, swallowed cancellation, or incorrect state values.
    • Configuration: Hazards related to merging configurations or leaving supposedly frozen configurations mutable.
  6. Overview of ActualLab.Core namespaces

    master

    The ActualLab.Core library is organized into several functional namespaces:

    • ActualLab (Root): Core types like Result<T>, Option<T>, Requirement<T>, and HostId.
    • ActualLab.Time: Unix-style time primitives including Moment, CpuTimestamp, and MomentClock.
    • ActualLab.Async: Async/await utilities such as AsyncLock, AsyncState<T>, BatchProcessor<TIn, TOut>, and AsyncChain.
    • ActualLab.Collections: Specialized structures like PropertyBag, MemoryBuffer<T>, RingBuffer<T>, and ImmutableBimap<K, V>.
    • ActualLab.Serialization: Unified infrastructure with IByteSerializer, ITextSerializer, and lazy wrappers like UniSerialized<T>.
    • ActualLab.Locking: Synchronization primitives including AsyncLock and FileLock.
    • ActualLab.Resilience: Fault tolerance tools like RetryPolicy, Transiency, and ChaosMaker.
    • ActualLab.Caching: Caching implementations like FileSystemCache and MemoizingCache<TKey, TValue>.
    • ActualLab.Versioning: Optimistic concurrency tools like VersionGenerator<T> and VersionSet<T>.
    • ActualLab.Text: Text utilities including Symbol (interned strings) and ListFormat.
  7. Overview of Operations Framework (OF)

    master

    The Operations Framework (OF) is a foundation for building distributed systems with Fusion. It addresses three critical challenges in multi-host environments:

    1. Multi-host cache invalidation: Ensures that when data changes on one server, all other servers invalidate their local caches of computed values.
    2. Reliable command processing: Guarantees that commands are executed exactly once, even during failures.
    3. Event-driven architecture: Enables commands to produce events that are processed asynchronously with guaranteed delivery.

    OF implements the Transactional Outbox Pattern, writing operations to a database in the same transaction as your business data to ensure at-least-once delivery.

  8. What is Fusion?

    master

    Fusion is a .NET library designed to simplify the development of real-time, reactive applications. It provides two primary capabilities to handle the complexities of data synchronization and performance:

    1. Data Freshness: It ensures applications always display up-to-date information by automatically updating data when changes occur, ensuring all connected users see the same current state without manual refreshes.
    2. Performance Optimization: It improves application speed and efficiency through intelligent data caching and by transferring only the specific data that has changed (delta updates), maintaining responsiveness even with complex datasets.

    Fusion is particularly useful for building real-time dashboards, collaborative tools, offline-capable applications, and live data views.

  9. Overview of ActualLab.Fusion.Server

    master
    ActualLab.Fusion.Server provides the server-side implementation of Fusion, a framework for 'computed observables' designed for distributed applications. It enables building reactive state synchronization systems that are thread-safe, asynchronous, and immutable. The server is capable of serving replicas of computed instances to remote clients, facilitating real-time state sync and RPC (Remote Procedure Call) capabilities in .NET and Blazor environments.
  10. Overview of ActualLab.Plugins

    master

    ActualLab.Plugins is a MEF-style (Managed Extensibility Framework) plugin library designed to provide the core capabilities required to add plugins to a .NET application. Its primary focus is building an IoC (Inversion of Control) container that hosts these plugins.

    Key features include:

    • On-demand loading: Assemblies hosting plugins are only loaded when the plugins are accessed via the IoC container.
    • Fast startup: The library caches reflected information about plugins to ensure the IoC container is created quickly, updating the cache only when plugins change.
  11. Overview of ActualLab.Redis

    master
    ActualLab.Redis is a collection of helper utilities designed for working with Redis. It is a component of the larger ActualLab.Fusion ecosystem, which provides an end-to-end reactive state synchronization and RPC framework for .NET and Blazor. Fusion leverages these Redis helpers to enable features like automatic caching, dependency tracking, and precise cache invalidation.