gateway

package
v0.0.0-...-52d38b8 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2020 License: BSD-3-Clause Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultConfig = Config{
		PrometheusConfig:   ServerConfig{Port: 9000, Host: "0.0.0.0"},
		ServerConfig:       ServerConfig{Port: 5750, Host: "0.0.0.0"},
		GRPCImplementation: func(s *grpc.Server) {},
		UnaryInterceptors: []grpc.UnaryServerInterceptor{
			grpc_prometheus.UnaryServerInterceptor,
			grpc_recovery.UnaryServerInterceptor(),
		},
		StreamInterceptors: []grpc.StreamServerInterceptor{
			grpc_prometheus.StreamServerInterceptor,
			grpc_recovery.StreamServerInterceptor(),
		},
		Repository:        memory.New(),
		ReflectionEnabled: true,
	}
)

Functions

func ContextClientInterceptor

func ContextClientInterceptor() grpc.UnaryClientInterceptor

ContextClientInterceptor passes around headers for tracing and linkerd

func New

func New(config Config) *gatewayServer

func RegisterGatewayServer

func RegisterGatewayServer(s *grpc.Server, srv GatewayServer)

Types

type Config

type Config struct {
	ServerConfig       ServerConfig
	PrometheusConfig   ServerConfig
	UnaryInterceptors  []grpc.UnaryServerInterceptor
	StreamInterceptors []grpc.StreamServerInterceptor

	// Register implementations
	//
	// The grpc server instance is handed over in this method for additional Server/Service registrations
	GRPCImplementation RegisterImplementation
	GRPCOptions        []grpc.ServerOption
	Repository         Repository
	ReflectionEnabled  bool
}

type DatabaseService

type DatabaseService struct {
	Name                 string         `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Services             []*ServiceInfo `protobuf:"bytes,2,rep,name=services,proto3" json:"services,omitempty"`
	XXX_NoUnkeyedLiteral struct{}       `json:"-"`
	XXX_unrecognized     []byte         `json:"-"`
	XXX_sizecache        int32          `json:"-"`
}

func (*DatabaseService) Descriptor

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

func (*DatabaseService) GetName

func (m *DatabaseService) GetName() string

func (*DatabaseService) GetServices

func (m *DatabaseService) GetServices() []*ServiceInfo

func (*DatabaseService) ProtoMessage

func (*DatabaseService) ProtoMessage()

func (*DatabaseService) Reset

func (m *DatabaseService) Reset()

func (*DatabaseService) String

func (m *DatabaseService) String() string

func (*DatabaseService) XXX_DiscardUnknown

func (m *DatabaseService) XXX_DiscardUnknown()

func (*DatabaseService) XXX_Marshal

func (m *DatabaseService) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DatabaseService) XXX_Merge

func (m *DatabaseService) XXX_Merge(src proto.Message)

func (*DatabaseService) XXX_Size

func (m *DatabaseService) XXX_Size() int

func (*DatabaseService) XXX_Unmarshal

func (m *DatabaseService) XXX_Unmarshal(b []byte) error

type GatewayClient

type GatewayClient interface {
	Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error)
	Info(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*InfoResponse, error)
}

GatewayClient is the client API for Gateway service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewGatewayClient

func NewGatewayClient(cc *grpc.ClientConn) GatewayClient

type GatewayServer

type GatewayServer interface {
	Ping(context.Context, *PingRequest) (*PingResponse, error)
	Info(context.Context, *InfoRequest) (*InfoResponse, error)
}

GatewayServer is the server API for Gateway service.

type InfoRequest

type InfoRequest struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*InfoRequest) Descriptor

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

func (*InfoRequest) ProtoMessage

func (*InfoRequest) ProtoMessage()

func (*InfoRequest) Reset

func (m *InfoRequest) Reset()

func (*InfoRequest) String

func (m *InfoRequest) String() string

func (*InfoRequest) XXX_DiscardUnknown

func (m *InfoRequest) XXX_DiscardUnknown()

func (*InfoRequest) XXX_Marshal

func (m *InfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*InfoRequest) XXX_Merge

func (m *InfoRequest) XXX_Merge(src proto.Message)

func (*InfoRequest) XXX_Size

func (m *InfoRequest) XXX_Size() int

func (*InfoRequest) XXX_Unmarshal

func (m *InfoRequest) XXX_Unmarshal(b []byte) error

type InfoResponse

type InfoResponse struct {
	Databases            []*DatabaseService `protobuf:"bytes,1,rep,name=databases,proto3" json:"databases,omitempty"`
	XXX_NoUnkeyedLiteral struct{}           `json:"-"`
	XXX_unrecognized     []byte             `json:"-"`
	XXX_sizecache        int32              `json:"-"`
}

func (*InfoResponse) Descriptor

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

func (*InfoResponse) GetDatabases

func (m *InfoResponse) GetDatabases() []*DatabaseService

func (*InfoResponse) ProtoMessage

func (*InfoResponse) ProtoMessage()

func (*InfoResponse) Reset

func (m *InfoResponse) Reset()

func (*InfoResponse) String

func (m *InfoResponse) String() string

func (*InfoResponse) XXX_DiscardUnknown

func (m *InfoResponse) XXX_DiscardUnknown()

func (*InfoResponse) XXX_Marshal

func (m *InfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*InfoResponse) XXX_Merge

func (m *InfoResponse) XXX_Merge(src proto.Message)

func (*InfoResponse) XXX_Size

func (m *InfoResponse) XXX_Size() int

func (*InfoResponse) XXX_Unmarshal

func (m *InfoResponse) XXX_Unmarshal(b []byte) error

type ManagedLifeCycle

type ManagedLifeCycle interface {
	Stop() error
}

type MethodInfo

type MethodInfo struct {
	Name                 string   `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	IsClientStream       bool     `protobuf:"varint,2,opt,name=isClientStream,proto3" json:"isClientStream,omitempty"`
	IsServerStream       bool     `protobuf:"varint,3,opt,name=isServerStream,proto3" json:"isServerStream,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*MethodInfo) Descriptor

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

func (*MethodInfo) GetIsClientStream

func (m *MethodInfo) GetIsClientStream() bool

func (*MethodInfo) GetIsServerStream

func (m *MethodInfo) GetIsServerStream() bool

func (*MethodInfo) GetName

func (m *MethodInfo) GetName() string

func (*MethodInfo) ProtoMessage

func (*MethodInfo) ProtoMessage()

func (*MethodInfo) Reset

func (m *MethodInfo) Reset()

func (*MethodInfo) String

func (m *MethodInfo) String() string

func (*MethodInfo) XXX_DiscardUnknown

func (m *MethodInfo) XXX_DiscardUnknown()

func (*MethodInfo) XXX_Marshal

func (m *MethodInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MethodInfo) XXX_Merge

func (m *MethodInfo) XXX_Merge(src proto.Message)

func (*MethodInfo) XXX_Size

func (m *MethodInfo) XXX_Size() int

func (*MethodInfo) XXX_Unmarshal

func (m *MethodInfo) XXX_Unmarshal(b []byte) error

type PingRequest

type PingRequest struct {
	Value                string   `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*PingRequest) Descriptor

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

func (*PingRequest) GetValue

func (m *PingRequest) GetValue() string

func (*PingRequest) ProtoMessage

func (*PingRequest) ProtoMessage()

func (*PingRequest) Reset

func (m *PingRequest) Reset()

func (*PingRequest) String

func (m *PingRequest) String() string

func (*PingRequest) XXX_DiscardUnknown

func (m *PingRequest) XXX_DiscardUnknown()

func (*PingRequest) XXX_Marshal

func (m *PingRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PingRequest) XXX_Merge

func (m *PingRequest) XXX_Merge(src proto.Message)

func (*PingRequest) XXX_Size

func (m *PingRequest) XXX_Size() int

func (*PingRequest) XXX_Unmarshal

func (m *PingRequest) XXX_Unmarshal(b []byte) error

type PingResponse

type PingResponse struct {
	Value                string   `protobuf:"bytes,1,opt,name=Value,proto3" json:"Value,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*PingResponse) Descriptor

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

func (*PingResponse) GetValue

func (m *PingResponse) GetValue() string

func (*PingResponse) ProtoMessage

func (*PingResponse) ProtoMessage()

func (*PingResponse) Reset

func (m *PingResponse) Reset()

func (*PingResponse) String

func (m *PingResponse) String() string

func (*PingResponse) XXX_DiscardUnknown

func (m *PingResponse) XXX_DiscardUnknown()

func (*PingResponse) XXX_Marshal

func (m *PingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PingResponse) XXX_Merge

func (m *PingResponse) XXX_Merge(src proto.Message)

func (*PingResponse) XXX_Size

func (m *PingResponse) XXX_Size() int

func (*PingResponse) XXX_Unmarshal

func (m *PingResponse) XXX_Unmarshal(b []byte) error

type RegisterImplementation

type RegisterImplementation func(s *grpc.Server)

type ServerConfig

type ServerConfig struct {
	Port int
	Host string
}

ServerConfig is a generic server configuration

func (*ServerConfig) Address

func (c *ServerConfig) Address() string

Address Gets a logical addr for a ServerConfig

type ServiceInfo

type ServiceInfo struct {
	Name                 string        `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Metadata             string        `protobuf:"bytes,2,opt,name=metadata,proto3" json:"metadata,omitempty"`
	Methods              []*MethodInfo `protobuf:"bytes,3,rep,name=methods,proto3" json:"methods,omitempty"`
	XXX_NoUnkeyedLiteral struct{}      `json:"-"`
	XXX_unrecognized     []byte        `json:"-"`
	XXX_sizecache        int32         `json:"-"`
}

func (*ServiceInfo) Descriptor

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

func (*ServiceInfo) GetMetadata

func (m *ServiceInfo) GetMetadata() string

func (*ServiceInfo) GetMethods

func (m *ServiceInfo) GetMethods() []*MethodInfo

func (*ServiceInfo) GetName

func (m *ServiceInfo) GetName() string

func (*ServiceInfo) ProtoMessage

func (*ServiceInfo) ProtoMessage()

func (*ServiceInfo) Reset

func (m *ServiceInfo) Reset()

func (*ServiceInfo) String

func (m *ServiceInfo) String() string

func (*ServiceInfo) XXX_DiscardUnknown

func (m *ServiceInfo) XXX_DiscardUnknown()

func (*ServiceInfo) XXX_Marshal

func (m *ServiceInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ServiceInfo) XXX_Merge

func (m *ServiceInfo) XXX_Merge(src proto.Message)

func (*ServiceInfo) XXX_Size

func (m *ServiceInfo) XXX_Size() int

func (*ServiceInfo) XXX_Unmarshal

func (m *ServiceInfo) XXX_Unmarshal(b []byte) error

type UnimplementedGatewayServer

type UnimplementedGatewayServer struct {
}

UnimplementedGatewayServer can be embedded to have forward compatible implementations.

func (*UnimplementedGatewayServer) Info

func (*UnimplementedGatewayServer) Ping

Directories

Path Synopsis
Package proxy provides a reverse proxy handler for gRPC.
Package proxy provides a reverse proxy handler for gRPC.

Jump to

Keyboard shortcuts

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