driver

package
v1.27.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2021 License: Apache-2.0 Imports: 19 Imported by: 62

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterDriverServiceServer added in v1.19.0

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 added in v1.19.0

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 added in v1.19.0

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

func (*DriverLocation) GetDriverID added in v1.19.0

func (m *DriverLocation) GetDriverID() string

func (*DriverLocation) GetLocation added in v1.19.0

func (m *DriverLocation) GetLocation() string

func (*DriverLocation) ProtoMessage added in v1.19.0

func (*DriverLocation) ProtoMessage()

func (*DriverLocation) Reset added in v1.19.0

func (m *DriverLocation) Reset()

func (*DriverLocation) String added in v1.19.0

func (m *DriverLocation) String() string

func (*DriverLocation) XXX_DiscardUnknown added in v1.19.0

func (m *DriverLocation) XXX_DiscardUnknown()

func (*DriverLocation) XXX_Marshal added in v1.19.0

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

func (*DriverLocation) XXX_Merge added in v1.19.0

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

func (*DriverLocation) XXX_Size added in v1.19.0

func (m *DriverLocation) XXX_Size() int

func (*DriverLocation) XXX_Unmarshal added in v1.19.0

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

type DriverLocationRequest added in v1.19.0

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 added in v1.19.0

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

func (*DriverLocationRequest) GetLocation added in v1.19.0

func (m *DriverLocationRequest) GetLocation() string

func (*DriverLocationRequest) ProtoMessage added in v1.19.0

func (*DriverLocationRequest) ProtoMessage()

func (*DriverLocationRequest) Reset added in v1.19.0

func (m *DriverLocationRequest) Reset()

func (*DriverLocationRequest) String added in v1.19.0

func (m *DriverLocationRequest) String() string

func (*DriverLocationRequest) XXX_DiscardUnknown added in v1.19.0

func (m *DriverLocationRequest) XXX_DiscardUnknown()

func (*DriverLocationRequest) XXX_Marshal added in v1.19.0

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

func (*DriverLocationRequest) XXX_Merge added in v1.19.0

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

func (*DriverLocationRequest) XXX_Size added in v1.19.0

func (m *DriverLocationRequest) XXX_Size() int

func (*DriverLocationRequest) XXX_Unmarshal added in v1.19.0

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

type DriverLocationResponse added in v1.19.0

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 added in v1.19.0

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

func (*DriverLocationResponse) GetLocations added in v1.19.0

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

func (*DriverLocationResponse) ProtoMessage added in v1.19.0

func (*DriverLocationResponse) ProtoMessage()

func (*DriverLocationResponse) Reset added in v1.19.0

func (m *DriverLocationResponse) Reset()

func (*DriverLocationResponse) String added in v1.19.0

func (m *DriverLocationResponse) String() string

func (*DriverLocationResponse) XXX_DiscardUnknown added in v1.19.0

func (m *DriverLocationResponse) XXX_DiscardUnknown()

func (*DriverLocationResponse) XXX_Marshal added in v1.19.0

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

func (*DriverLocationResponse) XXX_Merge added in v1.19.0

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

func (*DriverLocationResponse) XXX_Size added in v1.19.0

func (m *DriverLocationResponse) XXX_Size() int

func (*DriverLocationResponse) XXX_Unmarshal added in v1.19.0

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

type DriverServiceClient added in v1.19.0

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 added in v1.19.0

func NewDriverServiceClient(cc *grpc.ClientConn) DriverServiceClient

type DriverServiceServer added in v1.19.0

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, tracer opentracing.Tracer, 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