daemon

package
v0.0.0-...-f2f6987 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2014 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

This package wraps the meekod functionality into a Daemon struct that can be imported and started inside of any Go program.

Index

Constants

This section is empty.

Variables

View Source
var ErrTerminated = errors.New("daemon already terminated")

Functions

This section is empty.

Types

type Config

type Config struct {
	Verbose bool
	Broker  *struct {
		Endpoints *struct {
			Logging *struct {
				ZeroMQ string `yaml:"zeromq"`
			} `yaml:"logging"`
			PubSub *struct {
				ZeroMQ *struct {
					Router string
					Pub    string
				} `yaml:"zeromq"`
			} `yaml:"pubsub"`
			RPC *struct {
				ZeroMQ    string `yaml:"zeromq"`
				WebSocket *struct {
					Address         string
					Token           string
					HeartbeatPeriod time.Duration `yaml:"heartbeat_period"`
				} `yaml:"websocket"`
			} `yaml:"rpc"`
		}
	}
	Supervisor *struct {
		Workspace  string
		MongoDbUrl string `yaml:"mongodb_url"`
		Token      string
	}
}

func ReadConfigFile

func ReadConfigFile(path string) (*Config, error)

func (*Config) PopulateEnviron

func (cfg *Config) PopulateEnviron() error

PopulateEnviron exports the values from the config file as environment variables so that the values are reachable from the agents.

This is not super clean solution, there is space for rethinking this.

type Daemon

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

func NewFromConfig

func NewFromConfig(config *Config, opts *Options) (*Daemon, error)

func NewFromConfigAsBytes

func NewFromConfigAsBytes(configBytes []byte, opts *Options) (*Daemon, error)

func NewFromConfigAsFile

func NewFromConfigAsFile(path string, opts *Options) (*Daemon, error)

func (*Daemon) Monitor

func (daemon *Daemon) Monitor(monitorCh chan<- *broker.EndpointCrashReport)

func (*Daemon) Serve

func (daemon *Daemon) Serve() (err error)

func (*Daemon) Terminate

func (daemon *Daemon) Terminate() error

Terminate shuts the daemon down.

This method blocks until the daemon is terminated.

ErrTerminated is returned in case Terminate has already been called.

func (*Daemon) TerminateZmq

func (daemon *Daemon) TerminateZmq() error

TerminateZmq calls Terminate(), then zmq.Term().

func (*Daemon) Terminated

func (daemon *Daemon) Terminated() <-chan struct{}

Terminated returns a channel that is closed when the daemon is terminated.

func (*Daemon) Wait

func (daemon *Daemon) Wait() error

Wait blocks until the daemon is terminated, then it returns the same return value that Serve returned.

type Options

type Options struct {

	// Do not start the agent supervisor.
	DisableSupervisor bool

	// Disable the inter-process service endpoints.
	// These are used to plug the local agents into the platform.
	// Can be useful in case only WebSocket is being used.
	DisableLocalEndpoints bool
}

Options can be used to define what parts of meekod will be started. This can be used to align meekod for a couple of scenarios.

Jump to

Keyboard shortcuts

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