adminserver

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

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

Go to latest
Published: Oct 25, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

README

turbinelabs/adminserver

This project is no longer maintained by Turbine Labs, which has shut down.

Apache 2.0 GoDoc CircleCI Go Report Card codecov

The adminserver package provides a tool to wrap a process with a simple HTTP server that manages the process lifecycle, including termination and signaling.

Requirements

  • Go 1.9 or later (previous versions may work, but we don't build or test against them)

Dependencies

The adminserver project depends on our nonstdlib package; The tests depend on our test package and gomock. It should always be safe to use HEAD of all master branches of Turbine Labs open source projects together, or to vendor them with the same git tag.

Install

go get -u github.com/turbinelabs/adminserver/...

Clone/Test

mkdir -p $GOPATH/src/turbinelabs
git clone https://github.com/turbinelabs/adminserver.git > $GOPATH/src/turbinelabs/adminserver
go test github.com/turbinelabs/adminserver/...

Godoc

adminserver

Versioning

Please see Versioning of Turbine Labs Open Source Projects.

Pull Requests

Patches accepted! Please see Contributing to Turbine Labs Open Source Projects.

Code of Conduct

All Turbine Labs open-sourced projects are released with a Contributor Code of Conduct. By participating in our projects you agree to abide by its terms, which will be carefully enforced.

Documentation

Overview

The adminserver package provides a tool to wrap a nonstdlib/proc.ManagedProc with a simple HTTP server that manages the process lifecycle, including termination and signaling it to reload its configuration.

An AdminServer can be constructed directly using adminserver.New(), or can be configured using a flag.FlagSet using adminserver.NewFromFlags().

Package adminserver is a generated GoMock package.

Package adminserver is a generated GoMock package.

Index

Constants

View Source
const (
	DefaultListenAddr = "127.0.0.1:9000"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminServer

type AdminServer interface {
	// Starts the HTTP server.
	Start() error

	// Stops the HTTP server.
	Close() error

	// If true, the HTTP server is up and listening for connections.
	Listening() bool

	// The host:port the HTTP server is listening on.
	Addr() string

	// The last signal sent to the process, if any.
	LastRequestedSignal() RequestedSignalType
}

AdminServer is an HTTP server that wraps a process. The admin server can send signals to the process. The server terminates when the wrapped process terminates. The server responds to the following URI paths:

/admin/reload
/admin/quit
/admin/kill

func New

func New(addr string, managedProc proc.ManagedProc) AdminServer

Creates a new AdminServer on the given IP address and port, wrapping the given ManagedProc.

type FromFlags

type FromFlags interface {
	// Make produces an AdminServer from the configured Flags.
	Make(managedProc proc.ManagedProc) AdminServer
}

The FromFlags interface models creation of an AdminServer from a flag.FlagSet, and validation of the relevant Flags in that FlagSet.

func NewFromFlags

func NewFromFlags(flags tbnflag.FlagSet) FromFlags

NewFromFlags installs the Flags necessary to configure an AdminServer into the provided flag.FlagSet, and returns a FromFlags.

type MockAdminServer

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

MockAdminServer is a mock of AdminServer interface

func NewMockAdminServer

func NewMockAdminServer(ctrl *gomock.Controller) *MockAdminServer

NewMockAdminServer creates a new mock instance

func (*MockAdminServer) Addr

func (m *MockAdminServer) Addr() string

Addr mocks base method

func (*MockAdminServer) Close

func (m *MockAdminServer) Close() error

Close mocks base method

func (*MockAdminServer) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockAdminServer) LastRequestedSignal

func (m *MockAdminServer) LastRequestedSignal() RequestedSignalType

LastRequestedSignal mocks base method

func (*MockAdminServer) Listening

func (m *MockAdminServer) Listening() bool

Listening mocks base method

func (*MockAdminServer) Start

func (m *MockAdminServer) Start() error

Start mocks base method

type MockAdminServerMockRecorder

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

MockAdminServerMockRecorder is the mock recorder for MockAdminServer

func (*MockAdminServerMockRecorder) Addr

Addr indicates an expected call of Addr

func (*MockAdminServerMockRecorder) Close

Close indicates an expected call of Close

func (*MockAdminServerMockRecorder) LastRequestedSignal

func (mr *MockAdminServerMockRecorder) LastRequestedSignal() *gomock.Call

LastRequestedSignal indicates an expected call of LastRequestedSignal

func (*MockAdminServerMockRecorder) Listening

func (mr *MockAdminServerMockRecorder) Listening() *gomock.Call

Listening indicates an expected call of Listening

func (*MockAdminServerMockRecorder) Start

Start indicates an expected call of Start

type MockFromFlags

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

MockFromFlags is a mock of FromFlags interface

func NewMockFromFlags

func NewMockFromFlags(ctrl *gomock.Controller) *MockFromFlags

NewMockFromFlags creates a new mock instance

func (*MockFromFlags) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockFromFlags) Make

func (m *MockFromFlags) Make(managedProc proc.ManagedProc) AdminServer

Make mocks base method

type MockFromFlagsMockRecorder

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

MockFromFlagsMockRecorder is the mock recorder for MockFromFlags

func (*MockFromFlagsMockRecorder) Make

func (mr *MockFromFlagsMockRecorder) Make(managedProc interface{}) *gomock.Call

Make indicates an expected call of Make

type RequestedSignalType

type RequestedSignalType int
const (
	NoRequestedSignal RequestedSignalType = iota
	RequestedKillSignal
	RequestedQuitSignal
	RequestedHangupSignal
)

Jump to

Keyboard shortcuts

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