goarken

package module
v0.0.0-...-c992646 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2016 License: LGPL-2.1 Imports: 11 Imported by: 1

README

go-arken

Build Status

Common Go libs to handle Arken model (domains, service)

Report & Contribute

We are glad to welcome new developers on this initiative, and even simple usage feedback is great.

  • Ask your questions on Nuxeo Answers
  • Report issues on this github repository (see issues link on the right)
  • Contribute: Send pull requests!

About Nuxeo

Nuxeo provides a modular, extensible Java-based open source software platform for enterprise content management, and packaged applications for document management, digital asset management and case management.

Designed by developers for developers, the Nuxeo platform offers a modern architecture, a powerful plug-in model and extensive packaging capabilities for building content applications.

More information on: http://www.nuxeo.com/

Documentation

Index

Constants

View Source
const (
	STARTING_STATUS   = "starting"
	STARTED_STATUS    = "started"
	STOPPING_STATUS   = "stopping"
	STOPPED_STATUS    = "stopped"
	ERROR_STATUS      = "error"
	WARNING_STATUS    = "warning"
	NA_STATUS         = "n/a"
	PASSIVATED_STATUS = "passivated"
)
View Source
const (
	TIME_FORMAT = "2006-01-02 15:04:05"
)

Variables

This section is empty.

Functions

func SetDomainPrefix

func SetDomainPrefix(domainPrefix string)

func SetServicePrefix

func SetServicePrefix(servicePrefix string)

Types

type Broadcaster

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

func NewBroadcaster

func NewBroadcaster() *Broadcaster

func (*Broadcaster) Listen

func (b *Broadcaster) Listen() chan interface{}

func (*Broadcaster) Write

func (b *Broadcaster) Write(message interface{})

type Domain

type Domain struct {
	Typ   string
	Value string
}

func GetDomainFromNode

func GetDomainFromNode(node *etcd.Node) *Domain

func GetDomainFromPath

func GetDomainFromPath(domainPath string, client *etcd.Client) (*Domain, error)

func NewDomain

func NewDomain(domainNode *etcd.Node) *Domain

func (*Domain) Equals

func (domain *Domain) Equals(other *Domain) bool

type Location

type Location struct {
	Host string `json:"host"`
	Port int    `json:"port"`
}

func (*Location) Equals

func (s *Location) Equals(other *Location) bool

func (*Location) IsFullyDefined

func (s *Location) IsFullyDefined() bool

type Service

type Service struct {
	Index      string         `json:"index"`
	NodeKey    string         `json:"nodeKey"`
	Location   *Location      `json:"location"`
	Domain     string         `json:"domain"`
	Name       string         `json:"name"`
	Status     *Status        `json:"status"`
	LastAccess *time.Time     `json:"lastAccess"`
	Config     *ServiceConfig `json:"config"`
	// contains filtered or unexported fields
}

func NewService

func NewService(serviceNode *etcd.Node) (*Service, error)

func (*Service) Equals

func (service *Service) Equals(other *Service) bool

func (*Service) StartedSince

func (s *Service) StartedSince() *time.Time

func (*Service) UnitName

func (s *Service) UnitName() string

type ServiceCluster

type ServiceCluster struct {
	Name      string     `json:"name"`
	Instances []*Service `json:"instances"`
	// contains filtered or unexported fields
}

func GetServiceClusterFromNode

func GetServiceClusterFromNode(clusterNode *etcd.Node) *ServiceCluster

func GetServiceClusterFromPath

func GetServiceClusterFromPath(serviceClusterPath string, client *etcd.Client) (*ServiceCluster, error)

func NewServiceCluster

func NewServiceCluster(name string) *ServiceCluster

func (*ServiceCluster) Add

func (cl *ServiceCluster) Add(service *Service)

func (*ServiceCluster) Dump

func (cl *ServiceCluster) Dump(action string)

func (*ServiceCluster) Get

func (cl *ServiceCluster) Get(instanceIndex string) *Service

Get an service by its key (index). Returns nil if not found.

func (*ServiceCluster) GetInstances

func (cl *ServiceCluster) GetInstances() []*Service

func (*ServiceCluster) Next

func (cl *ServiceCluster) Next() (*Service, error)

func (*ServiceCluster) Remove

func (cl *ServiceCluster) Remove(instanceIndex string)

type ServiceConfig

type ServiceConfig struct {
	Robots string `json:"robots"`
}

func (*ServiceConfig) Equals

func (config *ServiceConfig) Equals(other *ServiceConfig) bool

type Status

type Status struct {
	Alive    string   `json:"alive"`
	Current  string   `json:"current"`
	Expected string   `json:"expected"`
	Service  *Service `json:"-"`
}

func NewStatus

func NewStatus(service *Service, node *etcd.Node) *Status

func (*Status) Compute

func (s *Status) Compute() string

func (*Status) Equals

func (s *Status) Equals(other *Status) bool

type StatusError

type StatusError struct {
	ComputedStatus string
	Status         *Status
}

func (StatusError) Error

func (s StatusError) Error() string

type Watcher

type Watcher struct {
	Client        *etcd.Client
	DomainPrefix  string
	ServicePrefix string
	Domains       map[string]*Domain
	Services      map[string]*ServiceCluster
	// contains filtered or unexported fields
}

A Watcher loads and watch the etcd hierarchy for Domains and Services.

func (*Watcher) Init

func (w *Watcher) Init()

Init Domains and Services.

func (*Watcher) Listen

func (w *Watcher) Listen() chan interface{}

func (*Watcher) RemoveDomain

func (w *Watcher) RemoveDomain(key string)

func (*Watcher) RemoveEnv

func (w *Watcher) RemoveEnv(serviceName string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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