sr6

package
v0.0.0-...-392d1a8 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2016 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultSerfPort = 8201
)

Variables

View Source
var (
	DefaultRPCAddr = &net.TCPAddr{IP: net.ParseIP("0.0.0.0"), Port: 8300}
)
View Source
var ErrAmbariCredsError = errors.New("AMBARI_HTTP_AUTH is not set.")

Functions

func CorrectHostname

func CorrectHostname(suffix string) (string, error)

CorrectHostname ensures that server hostname ends with suffix, and adds random chars before the suffix if we are setting it now.

func OverwriteFile

func OverwriteFile(path, content string) error

OverwriteFile overwrites file at *path* with *content*

func RandString

func RandString(n int) string

RandString returns random string *n* chars long

func SetHostname

func SetHostname(name string) error

SetHostname sets hostname to *name*

Types

type Ambari

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

func (*Ambari) AddHost

func (a *Ambari) AddHost(hostname string) error

func (*Ambari) ListClusters

func (a *Ambari) ListClusters() (*ListClustersResponse, error)

type AmbariConfig

type AmbariConfig struct {
	// Addr is the server url:port
	Addr string

	// Auth is the ambari user:password
	Auth string
}

func DefaultAmbariConfig

func DefaultAmbariConfig() (*AmbariConfig, error)

type Config

type Config struct {
	// Node name is the name we use to advertise. Defaults to hostname.
	NodeName string

	// Leader decides if we are the leader
	Leader bool

	// SerfConfig is the configuration for serf
	SerfConfig *serf.Config

	// RPCAddr describes the
	RPCAddr *net.TCPAddr

	// HostsFile points to hosts file. Defaults to /etc/hosts
	HostsFile string

	// HostSuffix is os.Hostname suffix
	HostSuffix string

	// HostsUpdateInterval decides when to update hosts file
	HostsUpdateInterval time.Duration

	// Ambari config
	AmbariConfig *AmbariConfig
}

func DefaultConfig

func DefaultConfig() (*Config, error)

func MergeConfig

func MergeConfig(a, b *Config) *Config

type HostsManager

type HostsManager struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewHostsManager

func NewHostsManager(path string) (*HostsManager, error)

NewHosts parses hosts file at *path*

func (*HostsManager) String

func (h *HostsManager) String() string

type HttpBasicAuth

type HttpBasicAuth struct {
	// Username to use for HTTP Basic Authentication
	Username string

	// Password to use for HTTP Basic Authentication
	Password string
}

HttpBasicAuth is used to authenticate http client with HTTP Basic Authentication

type Internal

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

Internal serves as a endpoint for all internal operations These API's may not be directly exposed to clients

func (*Internal) Join

func (i *Internal) Join(addrs []string, reply *int) error

func (*Internal) Leave

func (i *Internal) Leave(_ string, _ *string) error

func (*Internal) Members

func (i *Internal) Members(_ string, reply *[]serf.Member) error

type ListClustersResponse

type ListClustersResponse struct {
	Items []struct {
		Href    string `json:"href"`
		Cluster struct {
			Name    string `json:"cluster_name"`
			Version string `json:"version"`
		} `json:"Clusters"`
	} `json:"items"`
}

type RPCClient

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

func NewRPCClient

func NewRPCClient(addr string) (*RPCClient, error)

func (*RPCClient) Close

func (c *RPCClient) Close() error

func (*RPCClient) Join

func (c *RPCClient) Join(addrs []string) (int, error)

func (*RPCClient) Leave

func (c *RPCClient) Leave() error

func (*RPCClient) Members

func (c *RPCClient) Members() ([]serf.Member, error)

type Request

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

Request is used to help build up a request

func NewRequest

func NewRequest(method, scheme, address, path, auth string, body io.Reader, client *http.Client) *Request

func (*Request) Do

func (r *Request) Do() (time.Duration, *http.Response, error)

Do runs a request with our client

type Server

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

Server is the main sr6 server

func NewServer

func NewServer(config *Config) (*Server, error)

func (*Server) Shutdown

func (s *Server) Shutdown() error

Shutdown closes all active servers running in background this method is called when Ctrl+C signal is received on shutdownCh

Jump to

Keyboard shortcuts

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