grpc

package
v0.0.0-...-ee19457 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authenticate

func Authenticate(ctx context.Context) (context.Context, error)

Authenticate authenticates the peer and returns the context

func NewGRPCServer

func NewGRPCServer(config *Config, options ...grpc.ServerOption) (*grpc.Server, error)

NewGRPCServer creates a new gRPC server

func Subject

func Subject(ctx context.Context) string

Subject returns the subject from the context

Types

type Authorizer

type Authorizer interface {
	Authorize(subject, object, action string) error
}

Authorizer is the interface that wraps the basic Authorize method

type CommitLog

type CommitLog interface {
	Write(*proto.Data) (uint64, error)
	Read(uint64) (*proto.Data, error)
}

CommitLog is the interface that wraps the basic Write and Read methods

type Config

type Config struct {
	CommitLog  CommitLog
	Authorizer Authorizer
}

Config contains the configuration for gRPC

type Server

type Server struct {
	proto.UnimplementedLogServer
	*Config
}

Server is a wrapper around proto.LogServer and Config

func (*Server) Consume

func (server *Server) Consume(ctx context.Context, request *proto.ConsumeRequest) (*proto.ConsumeResponse, error)

Consume is the implementation of the Consume RPC

func (*Server) ConsumeStream

func (server *Server) ConsumeStream(request *proto.ConsumeRequest, stream proto.Log_ConsumeStreamServer) error

ConsumeStream is the implementation of the ConsumeStream RPC

func (*Server) Produce

func (server *Server) Produce(ctx context.Context, request *proto.ProduceRequest) (*proto.ProduceResponse, error)

Produce is the implementation of the Produce RPC

func (*Server) ProduceStream

func (server *Server) ProduceStream(stream proto.Log_ProduceStreamServer) error

ProduceStream is the implementation of the ProduceStream RPC

type SubjectContextKey

type SubjectContextKey struct{}

SubjectContextKey returns the subject from the context

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL