Version: v0.0.0-...-9649366 Latest Latest

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

Go to latest
Published: Nov 21, 2019 License: Apache-2.0 Imports: 8 Imported by: 0




This section is empty.


This section is empty.


func CanGetProcessLimits

func CanGetProcessLimits() (bool, string)

CanGetProcessLimits returns a boolean to signify if it can return limits, and a warning message if it cannot.

func NewInterruptChannel

func NewInterruptChannel(numListeners int) <-chan error

NewInterruptChannel will return an interrupt channel useful with multiple listeners.

func WaitForInterrupt

func WaitForInterrupt(logger *zap.Logger, opts InterruptOptions)

WaitForInterrupt will wait for an interrupt to occur and return when done.


type File

type File interface {
	// Write bytes to the file descriptor.
	Write(p []byte) (int, error)
	// Sync fsyncs the file descriptor ensuring all writes have made it to disk.
	Sync() error
	// Close the file descriptor.
	Close() error

File is the interface implemented by *os.File.

type InterruptOptions

type InterruptOptions struct {
	// InterruptChannel is an existing interrupt channel, if none
	// specified one will be created.
	InterruptCh <-chan error

InterruptOptions are options to use when waiting for an interrupt.

type ProcessLimits

type ProcessLimits struct {
	NoFileCurr    uint64 // RLIMIT_NOFILE Current
	NoFileMax     uint64 // RLIMIT_NOFILE Max
	VMMaxMapCount int64  // corresponds to /proc/sys/vm/max_map_count
	VMSwappiness  int64  // corresponds to /proc/sys/vm/swappiness

ProcessLimits captures the different process limits.

func GetProcessLimits

func GetProcessLimits() (ProcessLimits, error)

GetProcessLimits returns the known process limits.

type RaiseProcessNoFileToNROpenResult

type RaiseProcessNoFileToNROpenResult struct {
	RaisePerformed  bool
	NROpenValue     uint64
	NoFileMaxValue  uint64
	NoFileCurrValue uint64

RaiseProcessNoFileToNROpenResult captures the result of trying to raise the process num files open limit to the nr_open system value.

func RaiseProcessNoFileToNROpen

func RaiseProcessNoFileToNROpen() (RaiseProcessNoFileToNROpenResult, error)

RaiseProcessNoFileToNROpen first determines the NROpen limit by reading the corresponding proc sys file and then if the hard or soft limits are below this number, the limits are raised using a call to setrlimit.

Jump to

Keyboard shortcuts

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