Package grpcserver
Overview ▹
Index ▹
func StartServer ¶
func StartServer()
StartServer starts the gRPC server The server listens on the port specified in the configuration file The server implements the ExternalFunctionsServer interface
func apiKeyAuthInterceptor ¶
func apiKeyAuthInterceptor(apiKey string) grpc.UnaryServerInterceptor
apiKeyAuthInterceptor is a gRPC server interceptor that checks for a valid API key in the metadata of the request The API key is passed as a string parameter
Parameters: - apiKey: a string containing the API key
Returns: - grpc.UnaryServerInterceptor: a gRPC server interceptor
func convertOptionSetValues ¶
func convertOptionSetValues(functionName string, inputName string, inputValue interface{}) (interface{}, error)
convertOptionSetValues converts the option set values for the given function and input
Parameters: - functionName: a string containing the function name - inputName: a string containing the input name - inputValue: an interface containing the input value
Returns: - interface: an interface containing the converted value - error: an error containing the error message
type server ¶
server is used to implement grpc_definition.ExternalFunctionsServer.
type server struct { allieflowkitgrpc.UnimplementedExternalFunctionsServer }
func (*server) ListFunctions ¶
func (s *server) ListFunctions(ctx context.Context, req *allieflowkitgrpc.ListFunctionsRequest) (*allieflowkitgrpc.ListFunctionsResponse, error)
ListFunctions lists all available function from the external functions package
Parameters: - ctx: the context of the request - req: the request to list all available functions
Returns: - allieflowkitgrpc.ListOfFunctions: a list of all available functions - error: an error if the function fails
func (*server) RunFunction ¶
func (s *server) RunFunction(ctx context.Context, req *allieflowkitgrpc.FunctionInputs) (output *allieflowkitgrpc.FunctionOutputs, err error)
RunFunction runs a function from the external functions package The function is identified by the function id The function inputs are passed as a list of FunctionInput
Parameters: - ctx: the context of the request - req: the request to run a function
Returns: - allieflowkitgrpc.FunctionOutputs: the outputs of the function - error: an error if the function fails
func (*server) StreamFunction ¶
func (s *server) StreamFunction(req *allieflowkitgrpc.FunctionInputs, stream allieflowkitgrpc.ExternalFunctions_StreamFunctionServer) (err error)
StreamFunction streams a function from the external functions package The function is identified by the function id The function inputs are passed as a list of FunctionInput
Parameters: - req: the request to stream a function - stream: the stream to send the function outputs
Returns: - error: an error if the function fails