stencilclient

package module
v0.0.0-...-ed4c537 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

README

stencilclient

import "github.com/odpf/stencil/clients/go"

Index

Variables

var (
    ErrNotFound = errors.New("not found")
)

type HTTPOptions

HTTPOptions options for http client

type HTTPOptions struct {
    // Timeout specifies a time limit for requests made by this client
    Timeout time.Duration
    // Headers provide extra headers to be added in requests made by this client
    Headers map[string]string
}

type Options

Options options for stencil client

type Options struct {
    // AutoRefresh boolean to enable or disable autorefresh. Default to false
    AutoRefresh bool
    // RefreshInterval refresh interval to fetch descriptor file from server.
    RefreshInterval time.Duration
    // HTTPOptions options for http client
    HTTPOptions
}

type StencilClient

StencilClient provides utility functions to parse protobuf messages at runtime. protobuf messages can be identified by specifying fully qualified generated proto java class name.

type StencilClient interface {
    // Parse parses protobuf message from wire format to protoreflect.Message given fully qualified name of proto message.
    // Returns ErrNotFound error if given class name is not found
    Parse(string, []byte) (protoreflect.ProtoMessage, error)
    // GetDescriptor returns protoreflect.MessageDescriptor given fully qualified proto java class name
    GetDescriptor(string) (protoreflect.MessageDescriptor, error)
    // Close stops background refresh if configured.
    Close()
}
func NewClient
func NewClient(url string, options Options) (StencilClient, error)

NewClient creates stencil client

func NewMultiURLClient
func NewMultiURLClient(urls []string, options Options) (StencilClient, error)

NewMultiURLClient creates stencil client with multiple urls

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("not found")
)

Functions

This section is empty.

Types

type HTTPOptions

type HTTPOptions struct {
	// Timeout specifies a time limit for requests made by this client
	Timeout time.Duration
	// Headers provide extra headers to be added in requests made by this client
	Headers map[string]string
}

HTTPOptions options for http client

type Options

type Options struct {
	// AutoRefresh boolean to enable or disable autorefresh. Default to false
	AutoRefresh bool
	// RefreshInterval refresh interval to fetch descriptor file from server.
	RefreshInterval time.Duration
	// HTTPOptions options for http client
	HTTPOptions
}

Options options for stencil client

type StencilClient

type StencilClient interface {
	// Parse parses protobuf message from wire format to protoreflect.Message given fully qualified name of proto message.
	// Returns ErrNotFound error if given class name is not found
	Parse(string, []byte) (protoreflect.ProtoMessage, error)
	// GetDescriptor returns protoreflect.MessageDescriptor given fully qualified proto java class name
	GetDescriptor(string) (protoreflect.MessageDescriptor, error)
	// Close stops background refresh if configured.
	Close()
}

StencilClient provides utility functions to parse protobuf messages at runtime. protobuf messages can be identified by specifying fully qualified generated proto java class name.

func NewClient

func NewClient(url string, options Options) (StencilClient, error)

NewClient creates stencil client

func NewMultiURLClient

func NewMultiURLClient(urls []string, options Options) (StencilClient, error)

NewMultiURLClient creates stencil client with multiple urls

Jump to

Keyboard shortcuts

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