http

package
v0.0.0-...-b46bbe4 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CtxRequestID ctxKey = iota
)

Variables

View Source
var (
	ErrorCode_name = map[int32]string{
		0: "InternalError",
		1: "RequestError",
		2: "ResponseError",
		3: "ConnectionError",
		4: "ConcurrencyContextError",
		5: "RequestAborted",
		6: "AuthenticationError",
	}
	ErrorCode_value = map[string]int32{
		"InternalError":           0,
		"RequestError":            1,
		"ResponseError":           2,
		"ConnectionError":         3,
		"ConcurrencyContextError": 4,
		"RequestAborted":          5,
		"AuthenticationError":     6,
	}
)

Enum value maps for ErrorCode.

View Source
var (
	Message_Method_name = map[int32]string{
		0: "NIL",
		1: "GET",
		2: "POST",
		3: "PUT",
		4: "PATCH",
	}
	Message_Method_value = map[string]int32{
		"NIL":   0,
		"GET":   1,
		"POST":  2,
		"PUT":   3,
		"PATCH": 4,
	}
)

Enum value maps for Message_Method.

View Source
var (
	Message_Authentication_name = map[int32]string{
		0: "NONE",
		1: "BASIC",
		2: "MUTUAL",
	}
	Message_Authentication_value = map[string]int32{
		"NONE":   0,
		"BASIC":  1,
		"MUTUAL": 2,
	}
)

Enum value maps for Message_Authentication.

View Source
var File_api_httpforkjoin_proto protoreflect.FileDescriptor
View Source
var HTTPForkJoinService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "http.HTTPForkJoinService",
	HandlerType: (*HTTPForkJoinServiceServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "FanoutFanin",
			Handler:       _HTTPForkJoinService_FanoutFanin_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "api/httpforkjoin.proto",
}

HTTPForkJoinService_ServiceDesc is the grpc.ServiceDesc for HTTPForkJoinService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterHTTPForkJoinServiceServer

func RegisterHTTPForkJoinServiceServer(s grpc.ServiceRegistrar, srv HTTPForkJoinServiceServer)

func RequestID

func RequestID(ctx context.Context) string

Types

type AUTHENTICATION

type AUTHENTICATION string

TODO: Is this type required?

const (
	NONE   AUTHENTICATION = "NONE"
	BASIC  AUTHENTICATION = "BASIC"
	MUTUAL AUTHENTICATION = "MUTUAL"
)

type BasicAuthCredentials

type BasicAuthCredentials struct {
	UserName          string
	Password          string
	ServerCertificate string
}

type DispatchServer

type DispatchServer struct {
	UnimplementedHTTPForkJoinServiceServer
}

DispatchServer implements GRPC server interface FannoutFannin

func (*DispatchServer) FanoutFanin

func (s *DispatchServer) FanoutFanin(request *Request, stream HTTPForkJoinService_FanoutFaninServer) error

FanoutFanin Fans out each http message to http dispatch works using the fork join interface

type DispatchWorker

type DispatchWorker struct {
	Request HTTPRequest
	// contains filtered or unexported fields
}

DispatchWorker dispatches to the configured URL

func (*DispatchWorker) ActiveDeadLineSeconds

func (hdw *DispatchWorker) ActiveDeadLineSeconds() uint32

func (*DispatchWorker) Work

func (hdw *DispatchWorker) Work(ctx context.Context, x interface{}) (<-chan f.Result, <-chan f.Heartbeat)

Work dispatches http request and stream a response back

type Error

type Error struct {
	Code    ErrorCode `protobuf:"varint,1,opt,name=code,proto3,enum=http.ErrorCode" json:"code,omitempty"`
	Message string    `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*Error) Descriptor deprecated

func (*Error) Descriptor() ([]byte, []int)

Deprecated: Use Error.ProtoReflect.Descriptor instead.

func (*Error) GetCode

func (x *Error) GetCode() ErrorCode

func (*Error) GetMessage

func (x *Error) GetMessage() string

func (*Error) ProtoMessage

func (*Error) ProtoMessage()

func (*Error) ProtoReflect

func (x *Error) ProtoReflect() protoreflect.Message

func (*Error) Reset

func (x *Error) Reset()

func (*Error) String

func (x *Error) String() string

type ErrorCode

type ErrorCode int32
const (
	ErrorCode_InternalError           ErrorCode = 0
	ErrorCode_RequestError            ErrorCode = 1
	ErrorCode_ResponseError           ErrorCode = 2
	ErrorCode_ConnectionError         ErrorCode = 3
	ErrorCode_ConcurrencyContextError ErrorCode = 4
	ErrorCode_RequestAborted          ErrorCode = 5
	ErrorCode_AuthenticationError     ErrorCode = 6
)

func (ErrorCode) Descriptor

func (ErrorCode) Descriptor() protoreflect.EnumDescriptor

func (ErrorCode) Enum

func (x ErrorCode) Enum() *ErrorCode

func (ErrorCode) EnumDescriptor deprecated

func (ErrorCode) EnumDescriptor() ([]byte, []int)

Deprecated: Use ErrorCode.Descriptor instead.

func (ErrorCode) Number

func (x ErrorCode) Number() protoreflect.EnumNumber

func (ErrorCode) String

func (x ErrorCode) String() string

func (ErrorCode) Type

type HTTPForkJoinServiceClient

type HTTPForkJoinServiceClient interface {
	FanoutFanin(ctx context.Context, in *Request, opts ...grpc.CallOption) (HTTPForkJoinService_FanoutFaninClient, error)
}

HTTPForkJoinServiceClient is the client API for HTTPForkJoinService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type HTTPForkJoinServiceServer

type HTTPForkJoinServiceServer interface {
	FanoutFanin(*Request, HTTPForkJoinService_FanoutFaninServer) error
	// contains filtered or unexported methods
}

HTTPForkJoinServiceServer is the server API for HTTPForkJoinService service. All implementations must embed UnimplementedHTTPForkJoinServiceServer for forward compatibility

type HTTPForkJoinService_FanoutFaninClient

type HTTPForkJoinService_FanoutFaninClient interface {
	Recv() (*Response, error)
	grpc.ClientStream
}

type HTTPForkJoinService_FanoutFaninServer

type HTTPForkJoinService_FanoutFaninServer interface {
	Send(*Response) error
	grpc.ServerStream
}

type HTTPMessage

type HTTPMessage struct {
	ID                    string
	URL                   string
	Method                METHOD
	Payload               string
	Headers               map[string]string
	ActiveDeadLine        uint32
	StatusCode            int
	Authentication        AUTHENTICATION
	BasicAtuhCredentials  BasicAuthCredentials
	MutualAuthCredentials MutualAuthCredentials
}

HTTPMessage URL and method to be dispatched too

func (*HTTPMessage) Add

func (hm *HTTPMessage) Add(key, value string)

Add adds headers to messsage

type HTTPRequest

type HTTPRequest struct {
	ID      string
	Message HTTPMessage
}

HTTPRequest URL and method to be dispatched too

type HTTPResponse

type HTTPResponse struct {
	Message HTTPMessage
}

HTTPResponse URL and method to be dispatched too

type METHOD

type METHOD string

METHOD http methods supported by http dispatcher

const (
	GET   METHOD = "GET"
	POST  METHOD = "POST"
	PUT   METHOD = "PUT"
	PATCH METHOD = "PATCH"
)

METHOD http methods supported by http dispatcher

type Message

type Message struct {
	URL                   string                         `protobuf:"bytes,1,opt,name=URL,proto3" json:"URL,omitempty"`
	Method                Message_Method                 `protobuf:"varint,3,opt,name=method,proto3,enum=http.Message_Method" json:"method,omitempty"`
	Headers               map[string]string              `` /* 155-byte string literal not displayed */
	Payload               string                         `protobuf:"bytes,5,opt,name=payload,proto3" json:"payload,omitempty"`
	StatusCode            uint32                         `protobuf:"varint,6,opt,name=statusCode,proto3" json:"statusCode,omitempty"`
	Id                    string                         `protobuf:"bytes,7,opt,name=Id,proto3" json:"Id,omitempty"`
	ActiveDeadLineSeconds uint32                         `protobuf:"varint,8,opt,name=activeDeadLineSeconds,proto3" json:"activeDeadLineSeconds,omitempty"`
	Authentication        Message_Authentication         `protobuf:"varint,9,opt,name=authentication,proto3,enum=http.Message_Authentication" json:"authentication,omitempty"`
	BasicAuthcredentials  *Message_BasicAuthCredentials  `protobuf:"bytes,10,opt,name=basicAuthcredentials,proto3" json:"basicAuthcredentials,omitempty"`
	MutualAuthCredentials *Message_MutualAuthCredentials `protobuf:"bytes,11,opt,name=mutualAuthCredentials,proto3" json:"mutualAuthCredentials,omitempty"`
	// contains filtered or unexported fields
}

func (*Message) Descriptor deprecated

func (*Message) Descriptor() ([]byte, []int)

Deprecated: Use Message.ProtoReflect.Descriptor instead.

func (*Message) GetActiveDeadLineSeconds

func (x *Message) GetActiveDeadLineSeconds() uint32

func (*Message) GetAuthentication

func (x *Message) GetAuthentication() Message_Authentication

func (*Message) GetBasicAuthcredentials

func (x *Message) GetBasicAuthcredentials() *Message_BasicAuthCredentials

func (*Message) GetHeaders

func (x *Message) GetHeaders() map[string]string

func (*Message) GetId

func (x *Message) GetId() string

func (*Message) GetMethod

func (x *Message) GetMethod() Message_Method

func (*Message) GetMutualAuthCredentials

func (x *Message) GetMutualAuthCredentials() *Message_MutualAuthCredentials

func (*Message) GetPayload

func (x *Message) GetPayload() string

func (*Message) GetStatusCode

func (x *Message) GetStatusCode() uint32

func (*Message) GetURL

func (x *Message) GetURL() string

func (*Message) ProtoMessage

func (*Message) ProtoMessage()

func (*Message) ProtoReflect

func (x *Message) ProtoReflect() protoreflect.Message

func (*Message) Reset

func (x *Message) Reset()

func (*Message) String

func (x *Message) String() string

type Message_Authentication

type Message_Authentication int32
const (
	Message_NONE   Message_Authentication = 0
	Message_BASIC  Message_Authentication = 1
	Message_MUTUAL Message_Authentication = 2
)

func (Message_Authentication) Descriptor

func (Message_Authentication) Enum

func (Message_Authentication) EnumDescriptor deprecated

func (Message_Authentication) EnumDescriptor() ([]byte, []int)

Deprecated: Use Message_Authentication.Descriptor instead.

func (Message_Authentication) Number

func (Message_Authentication) String

func (x Message_Authentication) String() string

func (Message_Authentication) Type

type Message_BasicAuthCredentials

type Message_BasicAuthCredentials struct {
	UserName          string `protobuf:"bytes,1,opt,name=UserName,proto3" json:"UserName,omitempty"`
	Password          string `protobuf:"bytes,2,opt,name=Password,proto3" json:"Password,omitempty"`
	ServerCertificate string `protobuf:"bytes,3,opt,name=ServerCertificate,proto3" json:"ServerCertificate,omitempty"`
	// contains filtered or unexported fields
}

func (*Message_BasicAuthCredentials) Descriptor deprecated

func (*Message_BasicAuthCredentials) Descriptor() ([]byte, []int)

Deprecated: Use Message_BasicAuthCredentials.ProtoReflect.Descriptor instead.

func (*Message_BasicAuthCredentials) GetPassword

func (x *Message_BasicAuthCredentials) GetPassword() string

func (*Message_BasicAuthCredentials) GetServerCertificate

func (x *Message_BasicAuthCredentials) GetServerCertificate() string

func (*Message_BasicAuthCredentials) GetUserName

func (x *Message_BasicAuthCredentials) GetUserName() string

func (*Message_BasicAuthCredentials) ProtoMessage

func (*Message_BasicAuthCredentials) ProtoMessage()

func (*Message_BasicAuthCredentials) ProtoReflect

func (*Message_BasicAuthCredentials) Reset

func (x *Message_BasicAuthCredentials) Reset()

func (*Message_BasicAuthCredentials) String

type Message_Method

type Message_Method int32
const (
	Message_NIL   Message_Method = 0
	Message_GET   Message_Method = 1
	Message_POST  Message_Method = 2
	Message_PUT   Message_Method = 3
	Message_PATCH Message_Method = 4
)

func (Message_Method) Descriptor

func (Message_Method) Enum

func (x Message_Method) Enum() *Message_Method

func (Message_Method) EnumDescriptor deprecated

func (Message_Method) EnumDescriptor() ([]byte, []int)

Deprecated: Use Message_Method.Descriptor instead.

func (Message_Method) Number

func (Message_Method) String

func (x Message_Method) String() string

func (Message_Method) Type

type Message_MutualAuthCredentials

type Message_MutualAuthCredentials struct {
	ClientCertificate string `protobuf:"bytes,1,opt,name=ClientCertificate,proto3" json:"ClientCertificate,omitempty"`
	ClientKey         string `protobuf:"bytes,2,opt,name=ClientKey,proto3" json:"ClientKey,omitempty"`
	CACertificate     string `protobuf:"bytes,3,opt,name=CACertificate,proto3" json:"CACertificate,omitempty"`
	// contains filtered or unexported fields
}

func (*Message_MutualAuthCredentials) Descriptor deprecated

func (*Message_MutualAuthCredentials) Descriptor() ([]byte, []int)

Deprecated: Use Message_MutualAuthCredentials.ProtoReflect.Descriptor instead.

func (*Message_MutualAuthCredentials) GetCACertificate

func (x *Message_MutualAuthCredentials) GetCACertificate() string

func (*Message_MutualAuthCredentials) GetClientCertificate

func (x *Message_MutualAuthCredentials) GetClientCertificate() string

func (*Message_MutualAuthCredentials) GetClientKey

func (x *Message_MutualAuthCredentials) GetClientKey() string

func (*Message_MutualAuthCredentials) ProtoMessage

func (*Message_MutualAuthCredentials) ProtoMessage()

func (*Message_MutualAuthCredentials) ProtoReflect

func (*Message_MutualAuthCredentials) Reset

func (x *Message_MutualAuthCredentials) Reset()

func (*Message_MutualAuthCredentials) String

type MutualAuthCredentials

type MutualAuthCredentials struct {
	ClientCertificate string
	ClientKey         string
	CACertificate     string
}

type Request

type Request struct {
	Api      string     `protobuf:"bytes,1,opt,name=api,proto3" json:"api,omitempty"`
	Messages []*Message `protobuf:"bytes,2,rep,name=messages,proto3" json:"messages,omitempty"`
	Id       string     `protobuf:"bytes,3,opt,name=Id,proto3" json:"Id,omitempty"`
	// contains filtered or unexported fields
}

func (*Request) Descriptor deprecated

func (*Request) Descriptor() ([]byte, []int)

Deprecated: Use Request.ProtoReflect.Descriptor instead.

func (*Request) GetApi

func (x *Request) GetApi() string

func (*Request) GetId

func (x *Request) GetId() string

func (*Request) GetMessages

func (x *Request) GetMessages() []*Message

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) ProtoReflect

func (x *Request) ProtoReflect() protoreflect.Message

func (*Request) Reset

func (x *Request) Reset()

func (*Request) String

func (x *Request) String() string

type Response

type Response struct {
	Message *Message `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	Errors  []*Error `protobuf:"bytes,2,rep,name=errors,proto3" json:"errors,omitempty"`
	Id      string   `protobuf:"bytes,3,opt,name=Id,proto3" json:"Id,omitempty"`
	// contains filtered or unexported fields
}

func (*Response) Descriptor deprecated

func (*Response) Descriptor() ([]byte, []int)

Deprecated: Use Response.ProtoReflect.Descriptor instead.

func (*Response) GetErrors

func (x *Response) GetErrors() []*Error

func (*Response) GetId

func (x *Response) GetId() string

func (*Response) GetMessage

func (x *Response) GetMessage() *Message

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) ProtoReflect

func (x *Response) ProtoReflect() protoreflect.Message

func (*Response) Reset

func (x *Response) Reset()

func (*Response) String

func (x *Response) String() string

type UnimplementedHTTPForkJoinServiceServer

type UnimplementedHTTPForkJoinServiceServer struct {
}

UnimplementedHTTPForkJoinServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedHTTPForkJoinServiceServer) FanoutFanin

type UnsafeHTTPForkJoinServiceServer

type UnsafeHTTPForkJoinServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeHTTPForkJoinServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to HTTPForkJoinServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

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