odrpc

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2020 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package odrpc is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	DoodsAuthKeyHeader = "doods-auth-key"
)

Variables

View Source
var (
	ErrInvalidLengthRpc = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowRpc   = fmt.Errorf("proto: integer overflow")
)

Functions

func RegisterOdrpcHandler

func RegisterOdrpcHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterOdrpcHandler registers the http handlers for service Odrpc to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterOdrpcHandlerClient

func RegisterOdrpcHandlerClient(ctx context.Context, mux *runtime.ServeMux, client OdrpcClient) error

RegisterOdrpcHandlerClient registers the http handlers for service Odrpc to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "OdrpcClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "OdrpcClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "OdrpcClient" to call the correct interceptors.

func RegisterOdrpcHandlerFromEndpoint

func RegisterOdrpcHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterOdrpcHandlerFromEndpoint is same as RegisterOdrpcHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterOdrpcHandlerServer added in v0.2.1

func RegisterOdrpcHandlerServer(ctx context.Context, mux *runtime.ServeMux, server OdrpcServer) error

RegisterOdrpcHandlerServer registers the http handlers for service Odrpc to "mux". UnaryRPC :call OdrpcServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.

func RegisterOdrpcServer

func RegisterOdrpcServer(s *grpc.Server, srv OdrpcServer)

Types

type DetectRegion added in v0.2.1

type DetectRegion struct {
	// Coordinates
	Top    float32 `protobuf:"fixed32,1,opt,name=top,proto3" json:"top"`
	Left   float32 `protobuf:"fixed32,2,opt,name=left,proto3" json:"left"`
	Bottom float32 `protobuf:"fixed32,3,opt,name=bottom,proto3" json:"bottom"`
	Right  float32 `protobuf:"fixed32,4,opt,name=right,proto3" json:"right"`
	// What to detect
	Detect map[string]float32 `` /* 155-byte string literal not displayed */
	Covers bool               `protobuf:"varint,6,opt,name=covers,proto3" json:"covers,omitempty"`
}

func (*DetectRegion) Descriptor added in v0.2.1

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

func (*DetectRegion) Equal added in v0.2.1

func (this *DetectRegion) Equal(that interface{}) bool

func (*DetectRegion) GetBottom added in v0.2.1

func (m *DetectRegion) GetBottom() float32

func (*DetectRegion) GetCovers added in v0.2.6

func (m *DetectRegion) GetCovers() bool

func (*DetectRegion) GetDetect added in v0.2.1

func (m *DetectRegion) GetDetect() map[string]float32

func (*DetectRegion) GetLeft added in v0.2.1

func (m *DetectRegion) GetLeft() float32

func (*DetectRegion) GetRight added in v0.2.1

func (m *DetectRegion) GetRight() float32

func (*DetectRegion) GetTop added in v0.2.1

func (m *DetectRegion) GetTop() float32

func (*DetectRegion) GoString added in v0.2.1

func (this *DetectRegion) GoString() string

func (*DetectRegion) Marshal added in v0.2.1

func (m *DetectRegion) Marshal() (dAtA []byte, err error)

func (*DetectRegion) MarshalTo added in v0.2.1

func (m *DetectRegion) MarshalTo(dAtA []byte) (int, error)

func (*DetectRegion) ProtoMessage added in v0.2.1

func (*DetectRegion) ProtoMessage()

func (*DetectRegion) Reset added in v0.2.1

func (m *DetectRegion) Reset()

func (*DetectRegion) Size added in v0.2.1

func (m *DetectRegion) Size() (n int)

func (*DetectRegion) String added in v0.2.1

func (this *DetectRegion) String() string

func (*DetectRegion) Unmarshal added in v0.2.1

func (m *DetectRegion) Unmarshal(dAtA []byte) error

func (*DetectRegion) XXX_DiscardUnknown added in v0.2.1

func (m *DetectRegion) XXX_DiscardUnknown()

func (*DetectRegion) XXX_Marshal added in v0.2.1

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

func (*DetectRegion) XXX_Merge added in v0.2.1

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

func (*DetectRegion) XXX_Size added in v0.2.1

func (m *DetectRegion) XXX_Size() int

func (*DetectRegion) XXX_Unmarshal added in v0.2.1

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

type DetectRequest

type DetectRequest struct {
	// The ID for the request.
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// The ID for the request.
	DetectorName string `protobuf:"bytes,2,opt,name=detector_name,json=detectorName,proto3" json:"detector_name,omitempty"`
	// The image data
	Data Raw `protobuf:"bytes,3,opt,name=data,proto3,casttype=Raw" json:"data"`
	// A filename
	File string `protobuf:"bytes,4,opt,name=file,proto3" json:"file,omitempty"`
	// What to detect
	Detect map[string]float32 `` /* 155-byte string literal not displayed */
	// Sub regions for detection
	Regions []*DetectRegion `protobuf:"bytes,6,rep,name=regions,proto3" json:"regions,omitempty"`
}

The Process Request

func (*DetectRequest) Descriptor

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

func (*DetectRequest) Equal

func (this *DetectRequest) Equal(that interface{}) bool

func (*DetectRequest) GetData

func (m *DetectRequest) GetData() Raw

func (*DetectRequest) GetDetect

func (m *DetectRequest) GetDetect() map[string]float32

func (*DetectRequest) GetDetectorName

func (m *DetectRequest) GetDetectorName() string

func (*DetectRequest) GetFile added in v0.2.5

func (m *DetectRequest) GetFile() string

func (*DetectRequest) GetId

func (m *DetectRequest) GetId() string

func (*DetectRequest) GetRegions added in v0.2.1

func (m *DetectRequest) GetRegions() []*DetectRegion

func (*DetectRequest) GoString

func (this *DetectRequest) GoString() string

func (*DetectRequest) Marshal

func (m *DetectRequest) Marshal() (dAtA []byte, err error)

func (*DetectRequest) MarshalTo

func (m *DetectRequest) MarshalTo(dAtA []byte) (int, error)

func (*DetectRequest) ProtoMessage

func (*DetectRequest) ProtoMessage()

func (*DetectRequest) Reset

func (m *DetectRequest) Reset()

func (*DetectRequest) Size

func (m *DetectRequest) Size() (n int)

func (*DetectRequest) String

func (this *DetectRequest) String() string

func (*DetectRequest) Unmarshal

func (m *DetectRequest) Unmarshal(dAtA []byte) error

func (*DetectRequest) XXX_DiscardUnknown

func (m *DetectRequest) XXX_DiscardUnknown()

func (*DetectRequest) XXX_Marshal

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

func (*DetectRequest) XXX_Merge

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

func (*DetectRequest) XXX_Size

func (m *DetectRequest) XXX_Size() int

func (*DetectRequest) XXX_Unmarshal

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

type DetectResponse

type DetectResponse struct {
	// The id for the response
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// The detected areas
	Detections []*Detection `protobuf:"bytes,2,rep,name=detections,proto3" json:"detections,omitempty"`
	// If there was an error (streaming endpoint only)
	Error string `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"`
}

func (*DetectResponse) Descriptor

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

func (*DetectResponse) Equal

func (this *DetectResponse) Equal(that interface{}) bool

func (*DetectResponse) GetDetections

func (m *DetectResponse) GetDetections() []*Detection

func (*DetectResponse) GetError

func (m *DetectResponse) GetError() string

func (*DetectResponse) GetId

func (m *DetectResponse) GetId() string

func (*DetectResponse) GoString

func (this *DetectResponse) GoString() string

func (*DetectResponse) Marshal

func (m *DetectResponse) Marshal() (dAtA []byte, err error)

func (*DetectResponse) MarshalTo

func (m *DetectResponse) MarshalTo(dAtA []byte) (int, error)

func (*DetectResponse) ProtoMessage

func (*DetectResponse) ProtoMessage()

func (*DetectResponse) Reset

func (m *DetectResponse) Reset()

func (*DetectResponse) Size

func (m *DetectResponse) Size() (n int)

func (*DetectResponse) String

func (this *DetectResponse) String() string

func (*DetectResponse) Unmarshal

func (m *DetectResponse) Unmarshal(dAtA []byte) error

func (*DetectResponse) XXX_DiscardUnknown

func (m *DetectResponse) XXX_DiscardUnknown()

func (*DetectResponse) XXX_Marshal

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

func (*DetectResponse) XXX_Merge

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

func (*DetectResponse) XXX_Size

func (m *DetectResponse) XXX_Size() int

func (*DetectResponse) XXX_Unmarshal

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

type Detection

type Detection struct {
	// Coordinates
	Top        float32 `protobuf:"fixed32,1,opt,name=top,proto3" json:"top"`
	Left       float32 `protobuf:"fixed32,2,opt,name=left,proto3" json:"left"`
	Bottom     float32 `protobuf:"fixed32,3,opt,name=bottom,proto3" json:"bottom"`
	Right      float32 `protobuf:"fixed32,4,opt,name=right,proto3" json:"right"`
	Label      string  `protobuf:"bytes,5,opt,name=label,proto3" json:"label"`
	Confidence float32 `protobuf:"fixed32,6,opt,name=confidence,proto3" json:"confidence"`
}

Area for detection

func (*Detection) Descriptor

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

func (*Detection) Equal

func (this *Detection) Equal(that interface{}) bool

func (*Detection) GetBottom

func (m *Detection) GetBottom() float32

func (*Detection) GetConfidence

func (m *Detection) GetConfidence() float32

func (*Detection) GetLabel

func (m *Detection) GetLabel() string

func (*Detection) GetLeft

func (m *Detection) GetLeft() float32

func (*Detection) GetRight

func (m *Detection) GetRight() float32

func (*Detection) GetTop

func (m *Detection) GetTop() float32

func (*Detection) GoString

func (this *Detection) GoString() string

func (*Detection) Marshal

func (m *Detection) Marshal() (dAtA []byte, err error)

func (*Detection) MarshalTo

func (m *Detection) MarshalTo(dAtA []byte) (int, error)

func (*Detection) ProtoMessage

func (*Detection) ProtoMessage()

func (*Detection) Reset

func (m *Detection) Reset()

func (*Detection) Size

func (m *Detection) Size() (n int)

func (*Detection) String

func (this *Detection) String() string

func (*Detection) Unmarshal

func (m *Detection) Unmarshal(dAtA []byte) error

func (*Detection) XXX_DiscardUnknown

func (m *Detection) XXX_DiscardUnknown()

func (*Detection) XXX_Marshal

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

func (*Detection) XXX_Merge

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

func (*Detection) XXX_Size

func (m *Detection) XXX_Size() int

func (*Detection) XXX_Unmarshal

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

type Detector

type Detector struct {
	// The name for this config
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// The name for this config
	Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
	// Model Name
	Model string `protobuf:"bytes,3,opt,name=model,proto3" json:"model,omitempty"`
	// Labels
	Labels []string `protobuf:"bytes,4,rep,name=labels,proto3" json:"labels,omitempty"`
	// The detection width
	Width int32 `protobuf:"varint,5,opt,name=width,proto3" json:"width,omitempty"`
	// The detection height
	Height int32 `protobuf:"varint,6,opt,name=height,proto3" json:"height,omitempty"`
	// The detection channels
	Channels int32 `protobuf:"varint,7,opt,name=channels,proto3" json:"channels,omitempty"`
}

func (*Detector) Descriptor

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

func (*Detector) Equal

func (this *Detector) Equal(that interface{}) bool

func (*Detector) GetChannels

func (m *Detector) GetChannels() int32

func (*Detector) GetHeight

func (m *Detector) GetHeight() int32

func (*Detector) GetLabels

func (m *Detector) GetLabels() []string

func (*Detector) GetModel

func (m *Detector) GetModel() string

func (*Detector) GetName

func (m *Detector) GetName() string

func (*Detector) GetType

func (m *Detector) GetType() string

func (*Detector) GetWidth

func (m *Detector) GetWidth() int32

func (*Detector) GoString

func (this *Detector) GoString() string

func (*Detector) Marshal

func (m *Detector) Marshal() (dAtA []byte, err error)

func (*Detector) MarshalTo

func (m *Detector) MarshalTo(dAtA []byte) (int, error)

func (*Detector) ProtoMessage

func (*Detector) ProtoMessage()

func (*Detector) Reset

func (m *Detector) Reset()

func (*Detector) Size

func (m *Detector) Size() (n int)

func (*Detector) String

func (this *Detector) String() string

func (*Detector) Unmarshal

func (m *Detector) Unmarshal(dAtA []byte) error

func (*Detector) XXX_DiscardUnknown

func (m *Detector) XXX_DiscardUnknown()

func (*Detector) XXX_Marshal

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

func (*Detector) XXX_Merge

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

func (*Detector) XXX_Size

func (m *Detector) XXX_Size() int

func (*Detector) XXX_Unmarshal

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

type GetDetectorsResponse

type GetDetectorsResponse struct {
	Detectors []*Detector `protobuf:"bytes,1,rep,name=detectors,proto3" json:"detectors,omitempty"`
}

func (*GetDetectorsResponse) Descriptor

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

func (*GetDetectorsResponse) Equal

func (this *GetDetectorsResponse) Equal(that interface{}) bool

func (*GetDetectorsResponse) GetDetectors

func (m *GetDetectorsResponse) GetDetectors() []*Detector

func (*GetDetectorsResponse) GoString

func (this *GetDetectorsResponse) GoString() string

func (*GetDetectorsResponse) Marshal

func (m *GetDetectorsResponse) Marshal() (dAtA []byte, err error)

func (*GetDetectorsResponse) MarshalTo

func (m *GetDetectorsResponse) MarshalTo(dAtA []byte) (int, error)

func (*GetDetectorsResponse) ProtoMessage

func (*GetDetectorsResponse) ProtoMessage()

func (*GetDetectorsResponse) Reset

func (m *GetDetectorsResponse) Reset()

func (*GetDetectorsResponse) Size

func (m *GetDetectorsResponse) Size() (n int)

func (*GetDetectorsResponse) String

func (this *GetDetectorsResponse) String() string

func (*GetDetectorsResponse) Unmarshal

func (m *GetDetectorsResponse) Unmarshal(dAtA []byte) error

func (*GetDetectorsResponse) XXX_DiscardUnknown

func (m *GetDetectorsResponse) XXX_DiscardUnknown()

func (*GetDetectorsResponse) XXX_Marshal

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

func (*GetDetectorsResponse) XXX_Merge

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

func (*GetDetectorsResponse) XXX_Size

func (m *GetDetectorsResponse) XXX_Size() int

func (*GetDetectorsResponse) XXX_Unmarshal

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

type OdrpcClient

type OdrpcClient interface {
	// Get Config
	GetDetectors(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*GetDetectorsResponse, error)
	// Process an request
	Detect(ctx context.Context, in *DetectRequest, opts ...grpc.CallOption) (*DetectResponse, error)
	// Process stream requests
	DetectStream(ctx context.Context, opts ...grpc.CallOption) (Odrpc_DetectStreamClient, error)
}

OdrpcClient is the client API for Odrpc service.

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

func NewOdrpcClient

func NewOdrpcClient(cc *grpc.ClientConn) OdrpcClient

type OdrpcServer

type OdrpcServer interface {
	// Get Config
	GetDetectors(context.Context, *empty.Empty) (*GetDetectorsResponse, error)
	// Process an request
	Detect(context.Context, *DetectRequest) (*DetectResponse, error)
	// Process stream requests
	DetectStream(Odrpc_DetectStreamServer) error
}

OdrpcServer is the server API for Odrpc service.

type Odrpc_DetectStreamClient

type Odrpc_DetectStreamClient interface {
	Send(*DetectRequest) error
	Recv() (*DetectResponse, error)
	grpc.ClientStream
}

type Odrpc_DetectStreamServer

type Odrpc_DetectStreamServer interface {
	Send(*DetectResponse) error
	Recv() (*DetectRequest, error)
	grpc.ServerStream
}

type Raw

type Raw []byte

Images are byte arrays

func (*Raw) MarshalJSON

func (r *Raw) MarshalJSON() ([]byte, error)

MarshalJSON for Raw fields is represented as base64

func (*Raw) UnmarshalJSON

func (r *Raw) UnmarshalJSON(in []byte) error

UnmarshalJSON for Raw fields is parsed as base64

Jump to

Keyboard shortcuts

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