mongodb

package
v0.0.0-...-8488f5b Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2016 License: BSD-3-Clause Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultHost        = "127.0.0.1"
	DefaultPort        = "27017"
	DefaultBinDir      = "/usr/bin"
	DefaultDataDir     = "/data"
	DefaultPassword    = ""
	DefaultOpTimeout   = 5 * time.Minute
	DefaultReplTimeout = 1 * time.Minute

	BinName    = "mongod"
	ConfigName = "mongod.conf"
)
View Source
const (
	Startup replicaState = iota
	Primary
	Secondary
	Recovering
	Startup2
	Unknown
	Arbiter
	Down
	Rollback
	Removed
)

Variables

View Source
var (
	// ErrRunning is returned when starting an already running process.
	ErrRunning = errors.New("process already running")

	// ErrStopped is returned when stopping an already stopped process.
	ErrStopped = errors.New("process already stopped")

	ErrNoReplicationStatus = errors.New("no replication status")
)

Functions

This section is empty.

Types

type Cmd

type Cmd struct {
	*exec.Cmd
	// contains filtered or unexported fields
}

Cmd wraps exec.Cmd and provides helpers for checking for expected exits.

func NewCmd

func NewCmd(cmd *exec.Cmd) *Cmd

NewCmd returns a new instance of Cmd that wraps cmd.

func (*Cmd) Err

func (cmd *Cmd) Err() error

Err returns an error if cmd stopped unexpectedly. Must wait for the Stopped channel to return first.

func (*Cmd) Start

func (cmd *Cmd) Start() error

Start executes the command.

func (*Cmd) Stop

func (cmd *Cmd) Stop() error

Stop marks the command as expecting an exit and stops the underlying command.

func (*Cmd) Stopped

func (cmd *Cmd) Stopped() <-chan struct{}

Stopped returns a channel that is closed when the process exits

type Handler

type Handler struct {
	Process     *Process
	Peer        *state.Peer
	Heartbeater discoverd.Heartbeater
	Logger      log15.Logger
	// contains filtered or unexported fields
}

Handler represents an HTTP API handler for the process.

func NewHandler

func NewHandler() *Handler

NewHandler returns a new instance of Handler.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP serves an HTTP request.

type Process

type Process struct {
	ID          string
	Singleton   bool
	Host        string
	Port        string
	BinDir      string
	DataDir     string
	Password    string
	ServerID    uint32
	OpTimeout   time.Duration
	ReplTimeout time.Duration

	Logger log15.Logger
	// contains filtered or unexported fields
}

Process represents a MongoDB process.

func NewProcess

func NewProcess() *Process

NewProcess returns a new instance of Process.

func (*Process) ConfigPath

func (p *Process) ConfigPath() string

func (*Process) DialInfo

func (p *Process) DialInfo() *mgo.DialInfo

DialInfo returns dial info for connecting to the local process as the "flynn" user.

func (*Process) Info

func (p *Process) Info() (*client.DatabaseInfo, error)

func (*Process) Ready

func (p *Process) Ready() <-chan state.DatabaseEvent

func (*Process) Reconfigure

func (p *Process) Reconfigure(config *state.Config) error

func (*Process) Start

func (p *Process) Start() error

func (*Process) Stop

func (p *Process) Stop() error

func (*Process) XLog

func (p *Process) XLog() xlog.XLog

func (*Process) XLogPosition

func (p *Process) XLogPosition() (xlog.Position, error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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