Skip to content
/ Slik Public

Distributed In-process Cache; a gRPC HTTP proxy for containerd

License

Notifications You must be signed in to change notification settings

Insvald/Slik

Repository files navigation

Build Integration tests Nuget The current version of Slik.Cache Slik.Cache uses MIT License

Slik.Cache

Distributed In-process Cache in C# and Net 5.0/6.0 with external gRPC API (HTTP/2, client/server certificates)

Based on a magnificent dotNext library and its Raft cluster implementation.

Implements IDistributedCache, a standard interface for .Net Core cache.

Simple initialization:

await Host
    .CreateDefaultBuilder()
    .UseSlik(new SlikOptions 
    { 
        Host = new IPEndPoint(IPAddress.Loopback, 3092),
        Members = new[] { "localhost:3092", "localhost:3093", "localhost:3094" }
    })
    .Build()
    .RunAsync();

Usage:

public class CacheConsumer
{
  private readonly IDistributedCache _cache;

  public CacheConsumer(IDistributedCache cache)
  {
      _cache = cache;
      _cache.SetString("Greeting", "Hello, world");
  }
  
  //...  
}

Update any node, updates are redirected to a cluster leader, and are replicated automatically to each node.

Sample project: examples/SlikNode

How to run a minimal cluster:

SlikNode --port=3092 --folder="node 1" --members=localhost:3092,localhost:3093,localhost:3094
SlikNode --port=3093 --folder="node 2" --members=localhost:3092,localhost:3093,localhost:3094
SlikNode --port=3094 --folder="node 3" --members=localhost:3092,localhost:3093,localhost:3094

Roadmap

  • Self-signed certificates generation
  • Support adding/removal of cluster members in runtime
  • More unit and integration tests to cover adding/removing cluster members
  • Docker compose for starting cluster in containers
  • Use IMemberDiscoveryService instead of config changes for cluster membership
  • Decouple command handling with Interpreter Framework
  • Optimize log entries, binary format instead of JSON
  • Backgound log compaction
  • Distributed locks

Slik.Cord tests

Slik.Cord

A gRPC HTTP proxy for containerd in C# and Net 5.0/6.0. Containerd API works locally via Unix domain socket (in Linux) or named pipe (in Windows), not allowing to connect to it from another computer/container. This proxy can solve the problem. Current implementation doesn't work on Windows.

Usage

Run SlikCord (preferably in a container). Connect to port 80 from any client with gRPC support using the regular containerd API.

Roadmap

  • Support for all containerd APIs
  • Integration tests for containers, images, version, content, events, introspection, namespaces
  • Integration tests for diff, leases, snapshots, tasks, ttrpc-events
  • Switch to HTTPS
  • Support self-signed certificates
  • Named pipes support
  • Unix domain socket on Linux support
  • Unix domain socket on Windows support