Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { Close() error GetID() string Send(*pb.TheRequest) (*pb.TheResponse, error) }
Client is an abstraction representing a client connection to each downstream service.
func MakeFireAndForget ¶
MakeFireAndForget creates a new Client that will send requests and not wait for a response.
type Config ¶
type Config struct { ID string GRPCServerPort int H1ServerPort int GRPCDownstreamServers []string GRPCProxy string H1DownstreamServers []string PercentageFailedRequests int SleepInMillis int TerminateAfter int FireAndForget bool DownstreamConnectionTimeout time.Duration ExtraArguments map[string]string }
Config holds the ,ain configuration for this service.
type MockClient ¶
type MockClient struct { IDToReturn string ResponseToReturn *pb.TheResponse ErrorToReturn error RequestReceived *pb.TheRequest RequestInterceptor func(req *pb.TheRequest) CloseWasCalled bool }
func (*MockClient) Close ¶
func (m *MockClient) Close() error
func (*MockClient) GetID ¶
func (m *MockClient) GetID() string
func (*MockClient) Send ¶
func (m *MockClient) Send(req *pb.TheRequest) (*pb.TheResponse, error)
type MockServer ¶
type MockServer struct {
IDToReturn string
}
func (MockServer) GetID ¶
func (m MockServer) GetID() string
func (MockServer) Shutdown ¶ added in v0.0.2
func (m MockServer) Shutdown() error
type MockStrategy ¶
type MockStrategy struct { ContextReceived context.Context RequestReceived *pb.TheRequest ResponseToReturn *pb.TheResponse ErrorToReturn error }
func (*MockStrategy) Do ¶
func (m *MockStrategy) Do(ctx context.Context, req *pb.TheRequest) (*pb.TheResponse, error)
type RequestHandler ¶
type RequestHandler struct { Strategy Strategy // public due to circular dependency between server and strategy // contains filtered or unexported fields }
RequestHandler is a protocol-independent request/response handler interface
func NewRequestHandler ¶ added in v0.0.2
func NewRequestHandler(config *Config) *RequestHandler
func (*RequestHandler) ConfigID ¶ added in v0.0.2
func (h *RequestHandler) ConfigID() string
func (*RequestHandler) Handle ¶
func (h *RequestHandler) Handle(ctx context.Context, req *pb.TheRequest) (*pb.TheResponse, error)
Handle takes in a request, processes it accordingly to its Strategy, an returns the response.
func (*RequestHandler) Stopping ¶ added in v0.0.2
func (h *RequestHandler) Stopping() <-chan struct{}
type Server ¶
Server is an abstraction representing each server made available to receive inbound connections.
type Strategy ¶
type Strategy interface {
Do(context.Context, *pb.TheRequest) (*pb.TheResponse, error)
}
Strategy is the algorithm applied by this service when it receives requests (c.f. http://wiki.c2.com/?StrategyPattern)
Click to show internal directories.
Click to hide internal directories.