couchdaemon

package
Version: v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package couchdaemon provides utilities for processes running as a CouchDB os_daemon.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned by the config API when a key is not available.
	ErrNotFound = errors.New("couchdaemon: config key not found")

	// ErrNotInitialized is returned by all API functions
	// before Init has been called.
	ErrNotInitialized = errors.New("couchdaemon: not initialized")
)

Functions

func ConfigSection

func ConfigSection(section string) (map[string]string, error)

ConfigSection reads a whole section from the CouchDB configuration. If the section is not present, the error will be ErrNotFound and the returned map will be nil.

func ConfigVal

func ConfigVal(section, item string) (string, error)

ConfigVal reads a parameter value from the CouchDB configuration. If the parameter is unset, the error will be ErrNotFound and the returned string will be empty.

func Init

func Init(exit chan<- struct{})

Init configures stdin and stdout for communication with couchdb.

The argument can be a writable channel or nil. If it is nil, the process will exit with status 0 when CouchDB signals that is exiting. If the value is a channel, the channel will be closed instead.

Stdin or stdout directly will confuse CouchDB should therefore be avoided.

You should call this function early in your initialization. The other API functions will return ErrNotInitialized until Init has been called.

func ServerURL

func ServerURL() (string, error)

ServerURL returns the URL of the CouchDB server that started the daemon.

Types

type LogWriter

type LogWriter interface {
	io.Writer
	// Err writes a message with level "error"
	Err(msg string) error
	// Info writes a message with level "info"
	Info(msg string) error
	// Info writes a message with level "debug"
	Debug(msg string) error
}

A LogWriter writes messages to the CouchDB log. Its method set is a subset of the methods provided by log/syslog.Writer.

func NewLogWriter

func NewLogWriter() LogWriter

NewLogWriter creates a log writer that outputs to the CouchDB log.

Source Files

Jump to

Keyboard shortcuts

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