grpcserver

package
v0.0.0-...-2e0f99f Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserIdKey    colabShieldContextKey = "userId"
	ProjectIdKey colabShieldContextKey = "projectId"
	RequestUUID  colabShieldContextKey = "requestUUID"
)

Variables

View Source
var (
	// Common status error for rejected files regardless of internal reason.
	ErrRejectedFiles = status.Error(codes.FailedPrecondition, "rejected files")
	ErrMarshalFail   = status.Error(codes.Internal, "failed to marshal JSON")
	ErrUnmarshalFail = status.Error(codes.Internal, "failed to unmarshal JSON")
	ErrRedisError    = status.Error(codes.Internal, "encountered an error with Redis")
	ErrUnknown       = status.Error(codes.Unknown, "unknown error")
)
View Source
var (
	// TODO: Unauthenticated may not be the best code for these errors but should do for now.
	ErrMissingMetadata           = status.Error(codes.Unauthenticated, "missing metadata")
	ErrMissingOrInvalidUserId    = status.Error(codes.Unauthenticated, "missing or invalid userId")
	ErrMissingOrInvalidProjectId = status.Error(codes.Unauthenticated, "missing or invalid projectId")
)

Functions

func UnaryInterceptor

func UnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

Types

type ColabShieldServer

type ColabShieldServer struct {
	protos.UnimplementedColabShieldServer
	// contains filtered or unexported fields
}

ColabShieldServer is serves a gRPC endpoint.

func NewColabShieldServer

func NewColabShieldServer(db domain.ColabDatabase) *ColabShieldServer

func (*ColabShieldServer) Claim

func (*ColabShieldServer) HealthCheck

func (*ColabShieldServer) InitProject

func (*ColabShieldServer) ListFiles

func (*ColabShieldServer) ListProjects

func (*ColabShieldServer) Release

func (*ColabShieldServer) Serve

func (css *ColabShieldServer) Serve(port int) (*grpc.Server, error)

func (*ColabShieldServer) Update

Jump to

Keyboard shortcuts

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