- Renamed Lossless class to Hyperview for clarity - Renamed Lossy class to View for simplicity - Updated all imports and references throughout the codebase - Updated documentation to reflect new terminology - Fixed test files to use new class names - Added proper exports in index files
1.8 KiB
1.8 KiB
Custom Resolvers
Overview
The CustomResolver
system provides a flexible framework for resolving property conflicts in distributed systems. It enables you to define custom resolution strategies through plugins, complete with type-safe dependencies between resolvers.
Key Features
- Plugin-based Architecture: Extend functionality with custom resolvers
- Type-Safe Dependencies: Compile-time checking of plugin dependencies
- Built-in Resolvers: Common resolution strategies included
- Efficient Processing: Only processes changed deltas
- Deterministic Results: Same input always produces the same output
Core Concepts
- Resolver Plugins: Implement resolution logic for properties
- Dependency Management: Declare and manage dependencies between plugins
- State Management: Maintain and update state based on incoming deltas
- Resolution Pipeline: Process updates and resolve final values
Getting Started
import { CustomResolver } from '../src/views/resolvers/custom-resolvers';
import { LastWriteWinsPlugin } from '../src/views/resolvers/custom-resolvers/plugins';
import { Hyperview } from '../src/views/hyperview';
// Create a hyperview view
const hyperview = new Hyperview();
// Create a resolver with a last-write-wins strategy
const resolver = new CustomResolver(hyperview, {
myProperty: new LastWriteWinsPlugin()
});
// Process updates through the hyperview view
// hyperview.applyDelta(delta);
// Get resolved values for specific entities
const result = resolver.resolve(['entity1', 'entity2']);
// Or get all resolved values
const allResults = resolver.resolveAll();
Next Steps
- Learn about Built-in Plugins
- Understand Type-Safe Dependencies
- Explore Creating Custom Plugins