Skip to content
This repository has been archived by the owner on Aug 9, 2023. It is now read-only.

Latest commit

 

History

History
36 lines (25 loc) · 817 Bytes

README.md

File metadata and controls

36 lines (25 loc) · 817 Bytes

GRPC pool for groupcache

A replacement for groupcache HTTPPool that uses GRPC to communicate with peers.

Usage

server := grpc.NewServer()

p := NewGRPCPool("127.0.0.1:5000", server)
p.Set(peerAddrs...)

getter := groupcache.GetterFunc(func(ctx groupcache.Context, key string, dest groupcache.Sink) error {
	dest.SetString(...)
	return nil
})

groupcache.NewGroup("grpcPool", 1<<20, getter)
lis, err := net.Listen("tcp", "127.0.0.1:5000")
if err != nil {
	log.Fatalf("Failed to start server")
}

server.Serve(lis)

Use GRPCPoolOptions to set the GRPC client dial options such as using compression, authentication etc.

To Do

  • Use GRPC Balancer to manage the peer connections
  • Peer discovery mechanism for Kubernetes