Documentation ¶
Overview ¶
Package portssvc implement Ports that exposes a gRPC API that allows to store and list Ports in persistence layer.
Index ¶
- type Config
- type GRPCServer
- func (s *GRPCServer) Address() net.Addr
- func (s *GRPCServer) ListPorts(ctx context.Context, _ *emptypb.Empty) (*portsgrpc.ListPortsResponse, error)
- func (s *GRPCServer) Serve(ctx context.Context) error
- func (s *GRPCServer) StorePort(ctx context.Context, req *portsgrpc.StorePortRequest) (*emptypb.Empty, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // GRPCServerAddress is a TCP address of the server. Env var: GRPC_SERVER_ADDRESS. Default: ":9090". GRPCServerAddress string `env:"GRPC_SERVER_ADDRESS" envDefault:":9090"` }
Config is a configuration for GRPCServer.
type GRPCServer ¶
type GRPCServer struct { portsgrpc.UnimplementedPortServiceServer // contains filtered or unexported fields }
GRPCServer is a gRPC server for Ports domain service.
func NewServer ¶
func NewServer(cfg Config) *GRPCServer
NewServer creates new GRPCServer with given configuration.
func (*GRPCServer) Address ¶
func (s *GRPCServer) Address() net.Addr
Address return the TCP address of the server.
func (*GRPCServer) ListPorts ¶
func (s *GRPCServer) ListPorts(ctx context.Context, _ *emptypb.Empty) (*portsgrpc.ListPortsResponse, error)
ListPorts handles the list ports request.
func (*GRPCServer) Serve ¶
func (s *GRPCServer) Serve(ctx context.Context) error
Serve starts the gRPC Ports server. The server is gracefully stopped on context cancel/timeout. TODO(dfurman): support request/response logging.
func (*GRPCServer) StorePort ¶
func (s *GRPCServer) StorePort(ctx context.Context, req *portsgrpc.StorePortRequest) (*emptypb.Empty, error)
StorePort handles the store port request.
Click to show internal directories.
Click to hide internal directories.