Documentation ¶
Index ¶
- Constants
- Variables
- func UnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (interface{}, error)
- type ColabShieldServer
- func (s *ColabShieldServer) Claim(ctx context.Context, req *protos.ClaimFilesRequest) (*protos.ClaimFilesResponse, error)
- func (s *ColabShieldServer) HealthCheck(ctx context.Context, _ *emptypb.Empty) (*protos.HealthCheckResponse, error)
- func (s *ColabShieldServer) InitProject(ctx context.Context, request *protos.InitProjectRequest) (*protos.InitProjectResponse, error)
- func (s *ColabShieldServer) ListFiles(ctx context.Context, request *protos.ListFilesRequest) (*protos.ListFilesResponse, error)
- func (s *ColabShieldServer) ListProjects(ctx context.Context, _ *emptypb.Empty) (*protos.ListProjectsResponse, error)
- func (s *ColabShieldServer) Release(ctx context.Context, request *protos.ReleaseFilesRequest) (*protos.ReleaseFilesResponse, error)
- func (css *ColabShieldServer) Serve(port int) (*grpc.Server, error)
- func (s *ColabShieldServer) Update(ctx context.Context, req *protos.UpdateFilesRequest) (*protos.UpdateFilesResponse, error)
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 (s *ColabShieldServer) Claim(ctx context.Context, req *protos.ClaimFilesRequest) (*protos.ClaimFilesResponse, error)
func (*ColabShieldServer) HealthCheck ¶
func (s *ColabShieldServer) HealthCheck(ctx context.Context, _ *emptypb.Empty) (*protos.HealthCheckResponse, error)
func (*ColabShieldServer) InitProject ¶
func (s *ColabShieldServer) InitProject(ctx context.Context, request *protos.InitProjectRequest) (*protos.InitProjectResponse, error)
func (*ColabShieldServer) ListFiles ¶
func (s *ColabShieldServer) ListFiles(ctx context.Context, request *protos.ListFilesRequest) (*protos.ListFilesResponse, error)
func (*ColabShieldServer) ListProjects ¶
func (s *ColabShieldServer) ListProjects(ctx context.Context, _ *emptypb.Empty) (*protos.ListProjectsResponse, error)
func (*ColabShieldServer) Release ¶
func (s *ColabShieldServer) Release(ctx context.Context, request *protos.ReleaseFilesRequest) (*protos.ReleaseFilesResponse, error)
func (*ColabShieldServer) Serve ¶
func (css *ColabShieldServer) Serve(port int) (*grpc.Server, error)
func (*ColabShieldServer) Update ¶
func (s *ColabShieldServer) Update(ctx context.Context, req *protos.UpdateFilesRequest) (*protos.UpdateFilesResponse, error)
Click to show internal directories.
Click to hide internal directories.