driver

package
v1.46.0-tgt.2 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterDriverServiceServer

func RegisterDriverServiceServer(s *grpc.Server, srv DriverServiceServer)

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a remote client that implements driver.Interface

func NewClient

func NewClient(tracer opentracing.Tracer, logger log.Factory, hostPort string) *Client

NewClient creates a new driver.Client

func (*Client) FindNearest

func (c *Client) FindNearest(ctx context.Context, location string) ([]Driver, error)

FindNearest implements driver.Interface#FindNearest as an RPC

type Driver

type Driver struct {
	DriverID string
	Location string
}

Driver describes a driver and the current car location.

type DriverLocation

type DriverLocation struct {
	DriverID             string   `protobuf:"bytes,1,opt,name=driverID,proto3" json:"driverID,omitempty"`
	Location             string   `protobuf:"bytes,2,opt,name=location,proto3" json:"location,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*DriverLocation) Descriptor

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

func (*DriverLocation) GetDriverID

func (m *DriverLocation) GetDriverID() string

func (*DriverLocation) GetLocation

func (m *DriverLocation) GetLocation() string

func (*DriverLocation) ProtoMessage

func (*DriverLocation) ProtoMessage()

func (*DriverLocation) Reset

func (m *DriverLocation) Reset()

func (*DriverLocation) String

func (m *DriverLocation) String() string

func (*DriverLocation) XXX_DiscardUnknown

func (m *DriverLocation) XXX_DiscardUnknown()

func (*DriverLocation) XXX_Marshal

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

func (*DriverLocation) XXX_Merge

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

func (*DriverLocation) XXX_Size

func (m *DriverLocation) XXX_Size() int

func (*DriverLocation) XXX_Unmarshal

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

type DriverLocationRequest

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

func (*DriverLocationRequest) Descriptor

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

func (*DriverLocationRequest) GetLocation

func (m *DriverLocationRequest) GetLocation() string

func (*DriverLocationRequest) ProtoMessage

func (*DriverLocationRequest) ProtoMessage()

func (*DriverLocationRequest) Reset

func (m *DriverLocationRequest) Reset()

func (*DriverLocationRequest) String

func (m *DriverLocationRequest) String() string

func (*DriverLocationRequest) XXX_DiscardUnknown

func (m *DriverLocationRequest) XXX_DiscardUnknown()

func (*DriverLocationRequest) XXX_Marshal

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

func (*DriverLocationRequest) XXX_Merge

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

func (*DriverLocationRequest) XXX_Size

func (m *DriverLocationRequest) XXX_Size() int

func (*DriverLocationRequest) XXX_Unmarshal

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

type DriverLocationResponse

type DriverLocationResponse struct {
	Locations            []*DriverLocation `protobuf:"bytes,1,rep,name=locations,proto3" json:"locations,omitempty"`
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_unrecognized     []byte            `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

func (*DriverLocationResponse) Descriptor

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

func (*DriverLocationResponse) GetLocations

func (m *DriverLocationResponse) GetLocations() []*DriverLocation

func (*DriverLocationResponse) ProtoMessage

func (*DriverLocationResponse) ProtoMessage()

func (*DriverLocationResponse) Reset

func (m *DriverLocationResponse) Reset()

func (*DriverLocationResponse) String

func (m *DriverLocationResponse) String() string

func (*DriverLocationResponse) XXX_DiscardUnknown

func (m *DriverLocationResponse) XXX_DiscardUnknown()

func (*DriverLocationResponse) XXX_Marshal

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

func (*DriverLocationResponse) XXX_Merge

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

func (*DriverLocationResponse) XXX_Size

func (m *DriverLocationResponse) XXX_Size() int

func (*DriverLocationResponse) XXX_Unmarshal

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

type DriverServiceClient

type DriverServiceClient interface {
	FindNearest(ctx context.Context, in *DriverLocationRequest, opts ...grpc.CallOption) (*DriverLocationResponse, error)
}

DriverServiceClient is the client API for DriverService service.

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

func NewDriverServiceClient

func NewDriverServiceClient(cc *grpc.ClientConn) DriverServiceClient

type DriverServiceServer

type DriverServiceServer interface {
	FindNearest(context.Context, *DriverLocationRequest) (*DriverLocationResponse, error)
}

DriverServiceServer is the server API for DriverService service.

type Interface

type Interface interface {
	FindNearest(ctx context.Context, location string) ([]Driver, error)
}

Interface exposed by the Driver service.

type Redis

type Redis struct {
	// contains filtered or unexported fields
}

Redis is a simulator of remote Redis cache

func (*Redis) FindDriverIDs

func (r *Redis) FindDriverIDs(ctx context.Context, location string) []string

FindDriverIDs finds IDs of drivers who are near the location.

func (*Redis) GetDriver

func (r *Redis) GetDriver(ctx context.Context, driverID string) (Driver, error)

GetDriver returns driver and the current car location

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server implements jaeger-demo-frontend service

func NewServer

func NewServer(hostPort string, otelExporter string, metricsFactory metrics.Factory, logger log.Factory) *Server

NewServer creates a new driver.Server

func (*Server) FindNearest

func (s *Server) FindNearest(ctx context.Context, location *DriverLocationRequest) (*DriverLocationResponse, error)

FindNearest implements gRPC driver interface

func (*Server) Run

func (s *Server) Run() error

Run starts the Driver server

Jump to

Keyboard shortcuts

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