Documentation ¶
Overview ¶
Package grpcsrv implements gRPC server.
See Protobuf specification at https://github.com/nmezhenskyi/rcs/blob/main/api/protobuf/rcs.proto.
Index ¶
- type Server
- func (s *Server) Close()
- func (s *Server) Delete(ctx context.Context, in *pb.DeleteRequest) (*pb.DeleteReply, error)
- func (s *Server) Get(ctx context.Context, in *pb.GetRequest) (*pb.GetReply, error)
- func (s *Server) Keys(ctx context.Context, in *pb.KeysRequest) (*pb.KeysReply, error)
- func (s *Server) Length(ctx context.Context, in *pb.LengthRequest) (*pb.LengthReply, error)
- func (s *Server) ListenAndServe(addr string) error
- func (s *Server) ListenAndServeTLS(addr, certFile, keyFile string) error
- func (s *Server) Ping(ctx context.Context, in *pb.PingRequest) (*pb.PingReply, error)
- func (s *Server) Purge(ctx context.Context, in *pb.PurgeRequest) (*pb.PurgeReply, error)
- func (s *Server) Set(ctx context.Context, in *pb.SetRequest) (*pb.SetReply, error)
- func (s *Server) Shutdown(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct { pb.UnimplementedCacheServiceServer // Embed for forward compatibility. Logger zerolog.Logger // By defaut Logger is disabled, but can be manually attached. // contains filtered or unexported fields }
Server implements RCS gRPC service.
func NewServer ¶
func NewServer(c *cache.CacheMap, opts ...grpc.ServerOption) *Server
NewServer initializes a new grpc Server instance ready to be used and returns a pointer to it. A zerolog.Logger can be attached to returned Server by accessing public field Server.Logger.
func (*Server) Close ¶
func (s *Server) Close()
Close immediately closes all active connections and listeners. For a graceful shutdown, use Shutdown.
func (*Server) Delete ¶
func (s *Server) Delete(ctx context.Context, in *pb.DeleteRequest) (*pb.DeleteReply, error)
func (*Server) Length ¶
func (s *Server) Length(ctx context.Context, in *pb.LengthRequest) (*pb.LengthReply, error)
func (*Server) ListenAndServe ¶
ListenAndServe listens on the given TCP network address addr and handles gRPC requests on incoming connections according to CacheService specification.
func (*Server) ListenAndServeTLS ¶
ListenAndServeTLS listens on the given TCP network address addr and handles gRPC requests on incoming TLS connections according to CacheService specification.
Requires valid certificate and key files containing PEM encoded data.
func (*Server) Purge ¶
func (s *Server) Purge(ctx context.Context, in *pb.PurgeRequest) (*pb.PurgeReply, error)