distributed

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2020 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ServiceName string `json:"service_name,omitempty"`
	Addr        string `json:"addr,omitempty"`
	HealthURL   string `json:"health_url,omitempty"`
}

Config is the configuration for the consul

type ConsulService

type ConsulService struct {
	Client     *api.Client
	KV         *api.KV
	Catalog    *api.Catalog
	Config     *Config
	ServiceIDs []string
}

ConsulService handles the client to interact with the consul agent

func (ConsulService) CaddyModule

func (ConsulService) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information

func (*ConsulService) Cleanup

func (c *ConsulService) Cleanup() error

Cleanup releases the holding resources

func (*ConsulService) GetPeers

func (c *ConsulService) GetPeers() ([]string, error)

GetPeers get the peers in the same cluster

func (*ConsulService) Provision

func (c *ConsulService) Provision(ctx caddy.Context) error

Provision init the consul's agent and establish connection

func (*ConsulService) UnmarshalCaddyfile

func (c *ConsulService) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile deserializes Caddyfile tokens into caddy cache's Handler

distributed consul {
  service_name
  addr
}

func (*ConsulService) Validate

func (c *ConsulService) Validate() error

Validate checks the resource is set up correctly

Jump to

Keyboard shortcuts

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