agent

package
v1.0.4-rc0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2018 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrInvalidMethod is used if the HTTP method is not supported
	ErrInvalidMethod = "Invalid method"
)

Variables

View Source
var (
	// JSONHandle is the codec that handles to JSON encode structs.
	JSONHandle = &codec.JsonHandle{
		HTMLCharsAsIs: true,
	}
)

Functions

func Listener

func Listener(proto, addr string, port int) (net.Listener, error)

Listener can be used to get a new listener using a custom bind address. If the bind provided address is empty, the BindAddr is used instead.

Types

type Command

type Command struct {
	command.Meta
	// contains filtered or unexported fields
}

Command is the agent command structure used to track passed args as well as the CLI meta.

func (*Command) Help

func (c *Command) Help() string

Help provides the help information for the agent command.

func (*Command) RPC

func (c *Command) RPC(method string, reply interface{}) error

RPC is used to make an RPC call to Replicator.

func (*Command) Run

func (c *Command) Run(args []string) int

Run triggers a run of the replicator agent by setting up and parsing the configuration and then initiating a new runner.

func (*Command) Synopsis

func (c *Command) Synopsis() string

Synopsis is provides a brief summary of the agent command.

type HTTPCodedError

type HTTPCodedError interface {
	error
	Code() int
}

HTTPCodedError is used to provide the HTTP error code.

func CodedError

func CodedError(c int, s string) HTTPCodedError

CodedError returns an interface to the Replicator HTTP error code.

type HTTPServer

type HTTPServer struct {
	Addr string
	// contains filtered or unexported fields
}

HTTPServer is used to wrap an Agent and expose it over an HTTP interface

func NewHTTPServer

func NewHTTPServer(agent *Command, config *structs.Config) (*HTTPServer, error)

NewHTTPServer starts the HTTP API server for the Replicator agent.

func (*HTTPServer) Shutdown

func (s *HTTPServer) Shutdown()

Shutdown is used to shutdown the HTTP server.

func (*HTTPServer) StatusLeaderRequest

func (s *HTTPServer) StatusLeaderRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)

StatusLeaderRequest is used to perform the Status.Leader API request.

Jump to

Keyboard shortcuts

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