cluster

package
v0.13.6 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterBootstrap

func RegisterBootstrap(kind string, bootstrap Bootstrap) (ok bool)

Types

type Bootstrap

type Bootstrap interface {
	Build(options BootstrapOptions) (err error)
	Id() (id string)
	Ip() (ip string)
	FindMembers(ctx context.Context) (addresses []string)
}

type BootstrapOptions

type BootstrapOptions struct {
	Log    logs.Logger
	AppId  string
	Config configures.Config
}

type Client

type Client interface {
	Do(ctx context.Context, method string, address string, uri string, header http.Header, body []byte) (status int, respHeader http.Header, respBody []byte, err error)
	Close()
}

func FastHttpClientBuilder

func FastHttpClientBuilder(options ClientOptions) (client Client, err error)

type ClientBuilder

type ClientBuilder func(options ClientOptions) (client Client, err error)

type ClientOptions

type ClientOptions struct {
	Log                 logs.Logger
	Https               bool
	TLS                 *tls.Config
	MaxIdleConnDuration time.Duration
	MaxConnsPerHost     int
	MaxIdleConnsPerHost int
	RequestTimeout      time.Duration
}

type FastHttpClient

type FastHttpClient struct {
	// contains filtered or unexported fields
}

func (*FastHttpClient) Close

func (client *FastHttpClient) Close()

func (*FastHttpClient) Do

func (client *FastHttpClient) Do(_ context.Context, method string, address string, uri string, header http.Header, body []byte) (status int, respHeader http.Header, respBody []byte, err error)

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(options HandlerOptions) *Handler

func (*Handler) Build added in v0.13.3

func (handler *Handler) Build(_ *server.HandlerOptions) (err error)

func (*Handler) Close

func (handler *Handler) Close()

func (*Handler) Handle

func (handler *Handler) Handle(writer http.ResponseWriter, request *http.Request) (ok bool)

func (*Handler) Name added in v0.13.3

func (handler *Handler) Name() (name string)

type HandlerOptions

type HandlerOptions struct {
	Log       logs.Logger
	Endpoints service.Endpoints
	Cluster   *Manager
}

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(options ManagerOptions) (manager *Manager, err error)

func (*Manager) Join

func (manager *Manager) Join()

func (*Manager) Leave

func (manager *Manager) Leave()

func (*Manager) Node

func (manager *Manager) Node() (node Node)

func (*Manager) Registrations

func (manager *Manager) Registrations() (registrations *RegistrationsManager)

type ManagerOptions

type ManagerOptions struct {
	Log               logs.Logger
	AppId             string
	Port              int
	Config            *configure.Cluster
	ClientHttps       bool
	ClientTLS         *tls.Config
	ClientBuilder     ClientBuilder
	DevMode           bool
	NodesProxyAddress string
}

type Node

type Node interface {
	Id() string
	AppendService(service string, internal bool)
}

type Registration

type Registration struct {
	Id       string
	Name     string
	Internal bool
	Address  string
	// contains filtered or unexported fields
}

func (*Registration) Key

func (r *Registration) Key() (key string)

func (*Registration) Request

func (r *Registration) Request(ctx context.Context, fn string, argument service.Argument) (result service.Result)

type Registrations

type Registrations struct {
	// contains filtered or unexported fields
}

func (*Registrations) Append

func (r *Registrations) Append(v *Registration)

func (*Registrations) Get

func (r *Registrations) Get(id string) (v *Registration, has bool)

func (*Registrations) Next

func (r *Registrations) Next() (v *Registration, has bool)

func (*Registrations) Remove

func (r *Registrations) Remove(v *Registration)

func (*Registrations) Size

func (r *Registrations) Size() (size int)

type RegistrationsManager

type RegistrationsManager struct {
	// contains filtered or unexported fields
}

func (*RegistrationsManager) Close

func (manager *RegistrationsManager) Close()

func (*RegistrationsManager) Get

func (manager *RegistrationsManager) Get(_ context.Context, name string) (endpoint service.Endpoint, has bool)

func (*RegistrationsManager) GetExact

func (manager *RegistrationsManager) GetExact(_ context.Context, name string, id string) (endpoint service.Endpoint, has bool)

Jump to

Keyboard shortcuts

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