demo

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_demo_demo_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type Client

type Client struct {
	*duh.Client
	// contains filtered or unexported fields
}

Client is a simple client that calls the Service

func NewClient

func NewClient(conf ClientConfig) *Client

func (*Client) RenderPixel

func (c *Client) RenderPixel(ctx context.Context, req *RenderPixelRequest, resp *RenderPixelResponse) error

RenderPixel sends a request to the service which calculates the pixel color of a Mandelbrot fractal at the given point in the image.

func (*Client) SayHello

func (c *Client) SayHello(ctx context.Context, req *SayHelloRequest, resp *SayHelloResponse) error

SayHello sends a name to the service using JSON, and the service says hello.

type ClientConfig

type ClientConfig struct {
	Endpoint string
	Client   *http.Client
}

type Handler

type Handler struct {
	Service *Service
}

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type RenderPixelRequest

type RenderPixelRequest struct {
	Complexity float64 `protobuf:"fixed64,1,opt,name=complexity,proto3" json:"complexity,omitempty"`
	Height     int64   `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"`
	Width      int64   `protobuf:"varint,3,opt,name=width,proto3" json:"width,omitempty"`
	I          int64   `protobuf:"varint,4,opt,name=i,proto3" json:"i,omitempty"`
	J          int64   `protobuf:"varint,5,opt,name=j,proto3" json:"j,omitempty"`
	// contains filtered or unexported fields
}

func (*RenderPixelRequest) Descriptor deprecated

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

Deprecated: Use RenderPixelRequest.ProtoReflect.Descriptor instead.

func (*RenderPixelRequest) GetComplexity

func (x *RenderPixelRequest) GetComplexity() float64

func (*RenderPixelRequest) GetHeight

func (x *RenderPixelRequest) GetHeight() int64

func (*RenderPixelRequest) GetI

func (x *RenderPixelRequest) GetI() int64

func (*RenderPixelRequest) GetJ

func (x *RenderPixelRequest) GetJ() int64

func (*RenderPixelRequest) GetWidth

func (x *RenderPixelRequest) GetWidth() int64

func (*RenderPixelRequest) ProtoMessage

func (*RenderPixelRequest) ProtoMessage()

func (*RenderPixelRequest) ProtoReflect

func (x *RenderPixelRequest) ProtoReflect() protoreflect.Message

func (*RenderPixelRequest) Reset

func (x *RenderPixelRequest) Reset()

func (*RenderPixelRequest) String

func (x *RenderPixelRequest) String() string

type RenderPixelResponse

type RenderPixelResponse struct {

	// Gray represents an 8-bit grayscale color.
	Gray int64 `protobuf:"varint,1,opt,name=gray,proto3" json:"gray,omitempty"`
	// contains filtered or unexported fields
}

func (*RenderPixelResponse) Descriptor deprecated

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

Deprecated: Use RenderPixelResponse.ProtoReflect.Descriptor instead.

func (*RenderPixelResponse) GetGray

func (x *RenderPixelResponse) GetGray() int64

func (*RenderPixelResponse) ProtoMessage

func (*RenderPixelResponse) ProtoMessage()

func (*RenderPixelResponse) ProtoReflect

func (x *RenderPixelResponse) ProtoReflect() protoreflect.Message

func (*RenderPixelResponse) Reset

func (x *RenderPixelResponse) Reset()

func (*RenderPixelResponse) String

func (x *RenderPixelResponse) String() string

type SayHelloRequest

type SayHelloRequest struct {
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*SayHelloRequest) Descriptor deprecated

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

Deprecated: Use SayHelloRequest.ProtoReflect.Descriptor instead.

func (*SayHelloRequest) GetName

func (x *SayHelloRequest) GetName() string

func (*SayHelloRequest) ProtoMessage

func (*SayHelloRequest) ProtoMessage()

func (*SayHelloRequest) ProtoReflect

func (x *SayHelloRequest) ProtoReflect() protoreflect.Message

func (*SayHelloRequest) Reset

func (x *SayHelloRequest) Reset()

func (*SayHelloRequest) String

func (x *SayHelloRequest) String() string

type SayHelloResponse

type SayHelloResponse struct {
	Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*SayHelloResponse) Descriptor deprecated

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

Deprecated: Use SayHelloResponse.ProtoReflect.Descriptor instead.

func (*SayHelloResponse) GetMessage

func (x *SayHelloResponse) GetMessage() string

func (*SayHelloResponse) ProtoMessage

func (*SayHelloResponse) ProtoMessage()

func (*SayHelloResponse) ProtoReflect

func (x *SayHelloResponse) ProtoReflect() protoreflect.Message

func (*SayHelloResponse) Reset

func (x *SayHelloResponse) Reset()

func (*SayHelloResponse) String

func (x *SayHelloResponse) String() string

type Service

type Service struct{}

Service is an example of a production ready service implementation

func NewService

func NewService() *Service

NewService creates a new service instance

func (*Service) RenderPixel

func (h *Service) RenderPixel(ctx context.Context, req *RenderPixelRequest, resp *RenderPixelResponse) error

RenderPixel returns the color of a Mandelbrot fractal at the given point in the image. Code copied from Francesc Campoy's Golang Tracer example (https://tinyurl.com/ery6mfz8)

func (*Service) SayHello

func (h *Service) SayHello(ctx context.Context, req *SayHelloRequest, resp *SayHelloResponse) error

Jump to

Keyboard shortcuts

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