thor

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

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

Go to latest
Published: May 13, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

README

thor

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Initialize

func Initialize(options ...Option)

Initialize create the whole world of the current application.

Types

type ListenerOption

type ListenerOption struct {
	Type    ListenerType `yaml:"listener_type"`
	NetType string       `yaml:"listener_net_type"`
	Addr    string       `yaml:"listener_addr"`
}

type ListenerType

type ListenerType int
const (
	ListenerTypeTcp ListenerType = iota
	ListenerTypeGRPC
	ListenerTypeHTTP
)

func (ListenerType) String

func (l ListenerType) String() string

type LoggerOption

type LoggerOption struct {
	Dir         string `yaml:"log_dir"`
	LevelFilter string `yaml:"log_level_filter"`
}

type Option

type Option func(o *Options)

func Listeners

func Listeners(listeners ...ListenerOption) Option

func LogDir

func LogDir(s string) Option

func LogLevelFilter

func LogLevelFilter(l string) Option

func Metadata

func Metadata(meta metadata.Metadata) Option

func Namespace

func Namespace(s string) Option

func ServiceID

func ServiceID(s string) Option

func ServiceName

func ServiceName(s string) Option

func ServiceVersion

func ServiceVersion(s string) Option

type Options

type Options struct {
	Namespace      string            `yaml:"namespace"`
	ServiceName    string            `yaml:"service_name"`
	ServiceID      string            `yaml:"service_id"`
	ServiceVersion string            `yaml:"service_version"`
	Metadata       metadata.Metadata `yaml:"metadata"`
	Listeners      []ListenerOption  `yaml:"listeners"`
	Logger         LoggerOption      `yaml:"logger"`
	Trace          TraceOption       `yaml:"trace"`
	Registry       RegistryOption    `yaml:"registry"`
	Resilience     ResilienceOption  `yaml:"resilience"`
}

Options is the thor application global configuration.

func OptionReader

func OptionReader() Options

type RegistryOption

type RegistryOption struct {
	RegistryType string        `yaml:"registry_type"`
	RegistryAddr string        `yaml:"registry_addr"`
	RegistryTTL  time.Duration `yaml:"registry_ttl"`
}

type RegistryType

type RegistryType int
const (
	RegistryTypeEtcd RegistryType = iota
	RegistryTypeConsul
	RegistryTypeK8s
	RegistryMdns
)

func (RegistryType) String

func (r RegistryType) String() string

type ResilienceOption

type ResilienceOption struct {
	RetryOnIdempotent bool `yaml:"retry_on_idempotent"`
}

type TraceOption

type TraceOption struct {
	TraceSampleType  string  `yaml:"trace_sample_type"`
	TraceSampleParam float64 `yaml:"trace_sample_param"`
}

Directories

Path Synopsis
cmd
pkg
lb
web

Jump to

Keyboard shortcuts

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