Documentation
¶
Index ¶
- func Listen(conf *cmd.Conf, log zerolog.Logger, gs *grpc.Server)
- func NewGRPCServer(conf *cmd.Conf, l zerolog.Logger, cdb *database.CapybaraDB) (*grpc.Server, error)
- type CapybaraServer
- func (cap *CapybaraServer) AuthInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (interface{}, error)
- func (cap *CapybaraServer) ClaimLock(ctx context.Context, lr *pb.LockRequest) (*pb.LockResponse, error)
- func (cap *CapybaraServer) Delete(ctx context.Context, dr *pb.DeleteRequest) (*pb.DeleteResponse, error)
- func (cap *CapybaraServer) Get(ctx context.Context, gr *pb.GetRequest) (*pb.GetResponse, error)
- func (cap *CapybaraServer) Put(ctx context.Context, pr *pb.PutRequest) (*pb.PutResponse, error)
- func (cap *CapybaraServer) ReleaseLock(ctx context.Context, rr *pb.ReleaseRequest) (*pb.ReleaseResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CapybaraServer ¶
type CapybaraServer struct {
pb.UnimplementedCapybaraServer
// contains filtered or unexported fields
}
CapybaraServer represents the GRPC server.
func (*CapybaraServer) AuthInterceptor ¶
func (cap *CapybaraServer) AuthInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)
AuthInterceptor intercepts incoming grpc calls and will fetch the authentication token in the context TODO: True check.
func (*CapybaraServer) ClaimLock ¶
func (cap *CapybaraServer) ClaimLock(ctx context.Context, lr *pb.LockRequest) (*pb.LockResponse, error)
ClaimLock implements the CapybaraServer interface. This function can be used to acquire a lock. If the lock is already owned by another owner, the function will return the lock's details such as its expiration date, creation date and who the owner is.
func (*CapybaraServer) Delete ¶
func (cap *CapybaraServer) Delete(ctx context.Context, dr *pb.DeleteRequest) (*pb.DeleteResponse, error)
Delete will delete data from the kv store.
func (*CapybaraServer) Get ¶
func (cap *CapybaraServer) Get(ctx context.Context, gr *pb.GetRequest) (*pb.GetResponse, error)
Get will return data from the kv store (if any).
func (*CapybaraServer) Put ¶
func (cap *CapybaraServer) Put(ctx context.Context, pr *pb.PutRequest) (*pb.PutResponse, error)
Put will insert data in the kv store.
func (*CapybaraServer) ReleaseLock ¶
func (cap *CapybaraServer) ReleaseLock(ctx context.Context, rr *pb.ReleaseRequest) (*pb.ReleaseResponse, error)
ReleaseLock is used to release a lock. This method will only work if the client has ownership on the lock.