sentry

package module
v0.0.0-...-0780e06 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2018 License: GPL-3.0 Imports: 8 Imported by: 0

README

💂 Consul Sentry GoDoc

Getting Started

Consul sentry is a Go package, that receives consul watch event, and notifiies caller by function or channel.

Prerequisites

According to Consul agent watch documentation, the configuration must having explicit header type, supported types:

  • key
  • keyprefix
  • services
  • nodes
  • service
  • checks
  • event

Example

Please referring sample codes in examples

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChecksFunc

type ChecksFunc func([]*api.HealthCheck)

ChecksFunc Checks function

type ErrorFunc

type ErrorFunc func(r *http.Request)

ErrorFunc Error function

type EventFunc

type EventFunc func([]*api.UserEvent)

EventFunc Event function

type KeyFunc

type KeyFunc func(*api.KVPair)

KeyFunc Key function

type KeyPrefixFunc

type KeyPrefixFunc func(api.KVPairs)

KeyPrefixFunc KeyPrefix function

type NodesFunc

type NodesFunc func([]*api.Node)

NodesFunc Nodes function

type Sentry

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

Sentry Sentry

func NewSentry

func NewSentry() *Sentry

NewSentry Creating

func (*Sentry) DeleteChecksCh

func (s *Sentry) DeleteChecksCh(ch chan []*api.HealthCheck)

DeleteChecksCh Deleting nodes channel

func (*Sentry) DeleteEventCh

func (s *Sentry) DeleteEventCh(ch chan []*api.UserEvent)

DeleteEventCh Deleting event channel

func (*Sentry) DeleteKeyCh

func (s *Sentry) DeleteKeyCh(ch chan *api.KVPair)

DeleteKeyCh Deleting key channel

func (*Sentry) DeleteKeyPrefixCh

func (s *Sentry) DeleteKeyPrefixCh(ch chan api.KVPairs)

DeleteKeyPrefixCh Deleting key prefix channel

func (*Sentry) DeleteNodesCh

func (s *Sentry) DeleteNodesCh(ch chan []*api.Node)

DeleteNodesCh Deleting nodes channel

func (*Sentry) DeleteServiceCh

func (s *Sentry) DeleteServiceCh(ch chan []*api.ServiceEntry)

DeleteServiceCh Deleting service channel

func (*Sentry) DeleteServicesCh

func (s *Sentry) DeleteServicesCh(ch chan map[string][]string)

DeleteServicesCh Deleting services channel

func (*Sentry) GetChecksCh

func (s *Sentry) GetChecksCh() chan []*api.HealthCheck

GetChecksCh Returning nodes channel

func (*Sentry) GetEventCh

func (s *Sentry) GetEventCh() chan []*api.UserEvent

GetEventCh Returning event channel

func (*Sentry) GetKeyCh

func (s *Sentry) GetKeyCh() chan *api.KVPair

GetKeyCh Returning key channel

func (*Sentry) GetKeyPrefixCh

func (s *Sentry) GetKeyPrefixCh() chan api.KVPairs

GetKeyPrefixCh Returning key prefix channel

func (*Sentry) GetNodesCh

func (s *Sentry) GetNodesCh() chan []*api.Node

GetNodesCh Returning nodes channel

func (*Sentry) GetServiceCh

func (s *Sentry) GetServiceCh() chan []*api.ServiceEntry

GetServiceCh Returning service channel

func (*Sentry) GetServicesCh

func (s *Sentry) GetServicesCh() chan map[string][]string

GetServicesCh Returning services channel

func (*Sentry) SetAddress

func (s *Sentry) SetAddress(a string)

SetAddress Setting web server address

func (*Sentry) SetChecksFunc

func (s *Sentry) SetChecksFunc(fn ChecksFunc)

SetChecksFunc Setting checks function

func (*Sentry) SetErrorFunc

func (s *Sentry) SetErrorFunc(fn ErrorFunc)

SetErrorFunc Setting error function

func (*Sentry) SetEventFunc

func (s *Sentry) SetEventFunc(fn EventFunc)

SetEventFunc Setting event function

func (*Sentry) SetKeyFunc

func (s *Sentry) SetKeyFunc(fn KeyFunc)

SetKeyFunc Setting key function

func (*Sentry) SetKeyPrefixFunc

func (s *Sentry) SetKeyPrefixFunc(fn KeyPrefixFunc)

SetKeyPrefixFunc Setting key prefix function

func (*Sentry) SetNodesFunc

func (s *Sentry) SetNodesFunc(fn NodesFunc)

SetNodesFunc Setting nodes function

func (*Sentry) SetRoute

func (s *Sentry) SetRoute(r string)

SetRoute Setting route.

func (*Sentry) SetServiceFunc

func (s *Sentry) SetServiceFunc(fn ServiceFunc)

SetServiceFunc Setting service function

func (*Sentry) SetServicesFunc

func (s *Sentry) SetServicesFunc(fn ServicesFunc)

SetServicesFunc Setting services function

func (*Sentry) Start

func (s *Sentry) Start() error

Start Starting notifier

type ServiceFunc

type ServiceFunc func([]*api.ServiceEntry)

ServiceFunc Service function

type ServicesFunc

type ServicesFunc func(map[string][]string)

ServicesFunc Services function

type WatchType

type WatchType int

WatchType Watch type

const (
	// TypeKey Key type
	TypeKey WatchType = iota

	// TypeKeyPrefix KeyPrefix type
	TypeKeyPrefix

	// TypeServices Services type
	TypeServices

	// TypeNodes Nodes type
	TypeNodes

	// TypeService Service type
	TypeService

	// TypeChecks Checks type
	TypeChecks

	// TypeEvent Event type
	TypeEvent
)

func (WatchType) String

func (t WatchType) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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