Documentation ¶
Index ¶
- Constants
- Variables
- func AddStatusFuncs(fmap template.FuncMap)
- func AddStatusPart(banner, frag string, f func() interface{})
- func AddStatusSection(banner string, f func() string)
- func CheckServiceMap(protocol, name string) bool
- func Close()
- func GRPCCheckServiceMap(name string) bool
- func HandlePanic(component string, err *error)
- func Init()
- func InitServiceMap(protocol, name string)
- func OnClose(f func())
- func OnRun(f func())
- func OnTerm(f func())
- func OnTermSync(f func())
- func Register(name string, rcvr interface{})
- func RegisterDefaultFlags()
- func RegisterDefaultSocketFileFlags()
- func RegisterGRPCFlags()
- func Run(port int)
- func RunDefault()
- func ServeRPC()
- func StatusURLPath() string
Constants ¶
const JQueryIncludes = `` /* 287-byte string literal not displayed */
JQueryIncludes is the include to use to be able to use jquery and jquery-ui
Variables ¶
var ( // GRPCPort is the port to listen on for gRPC. If not set or zero, don't listen. GRPCPort *int // GRPCServer is the global server to serve gRPC. GRPCServer = grpc.NewServer() )
var ( // The flags used when calling RegisterDefaultFlags. Port *int // filled in when calling Run ListeningURL url.URL )
var ( // The flags used when calling RegisterDefaultSocketFileFlags. SocketFile *string )
Functions ¶
func AddStatusFuncs ¶
AddStatusFuncs merges the provided functions into the set of functions used to render /debug/status. Call this before AddStatusPart if your template requires custom functions.
func AddStatusPart ¶
func AddStatusPart(banner, frag string, f func() interface{})
AddStatusPart adds a new section to status. frag is used as a subtemplate of the template used to render /debug/status, and will be executed using the value of invoking f at the time of the /debug/status request. frag is parsed and executed with the html/template package. Functions registered with AddStatusFuncs may be used in the template.
func AddStatusSection ¶
AddStatusSection registers a function that generates extra information for /debug/status. If banner is not empty, it will be used as a header before the information. If more complex output than a simple string is required use AddStatusPart instead.
func CheckServiceMap ¶
CheckServiceMap returns if we should register a RPC service (and also logs how to enable / disable it)
func GRPCCheckServiceMap ¶
GRPCCheckServiceMap returns if we should register a gRPC service (and also logs how to enable / disable it)
func HandlePanic ¶
HandlePanic should be called using 'defer' in the RPC code that executes the command.
func InitServiceMap ¶
func InitServiceMap(protocol, name string)
InitServiceMap will set the default value for a protocol/name to be served.
func OnClose ¶
func OnClose(f func())
OnClose registers f to be run at the end of the app lifecycle. This happens after the lameduck period just before the program exits. All hooks are run in parallel.
func OnRun ¶
func OnRun(f func())
OnRun registers f to be run right at the beginning of Run. All hooks are run in parallel.
func OnTerm ¶
func OnTerm(f func())
OnTerm registers a function to be run when the process receives a SIGTERM. This allows the program to change its behavior during the lameduck period.
All hooks are run in parallel, and there is no guarantee that the process will wait for them to finish before dying when the lameduck period expires.
See also: OnTermSync
func OnTermSync ¶
func OnTermSync(f func())
OnTermSync registers a function to be run when the process receives SIGTERM. This allows the program to change its behavior during the lameduck period.
All hooks are run in parallel, and the process will do its best to wait (up to -onterm_timeout) for all of them to finish before dying.
See also: OnTerm
func Register ¶
func Register(name string, rcvr interface{})
Register registers a bsonrpc service according to serviceMap
func RegisterDefaultFlags ¶
func RegisterDefaultFlags()
RegisterDefaultFlags registers the default flags for listening to a given port for standard connections. If calling this, then call RunDefault()
func RegisterDefaultSocketFileFlags ¶
func RegisterDefaultSocketFileFlags()
RegisterDefaultSocketFileFlags registers the default flags for listening to a socket. It also registers an OnRun callback to enable the listening socket. This needs to be called before flags are parsed.
func RegisterGRPCFlags ¶
func RegisterGRPCFlags()
RegisterGRPCFlags registers the right command line flag to enable gRPC
Types ¶
This section is empty.