process

package
v0.0.0-...-5107381 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package process contains some utilities to help adapters keep track of processes that start or shut down.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListMatchingProcesses

func ListMatchingProcesses(match string, pe Enumerator) ([]uint32, error)

ListMatchingProcesses lists all IDs for processes that match the given string

Types

type Enumerator

type Enumerator interface {
	EnumerateProcesses() (map[uint32]string, error)
}

Enumerator defines the interface for enumerating processes on the system

type Scanner

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

Scanner polls the system for all running process names that match a given string and emits events to notify of any changes in this list.

func NewScanner

func NewScanner(
	processName string,
	scanTicker <-chan time.Time,
	pe Enumerator,
	eventBufSize int,
	logger *zap.Logger,
) *Scanner

NewScanner creates a new process scanner.

  • processName is a substring match query for the process name
  • scanTicker provides a mechanism for the Scanner to iterate on a given interval
  • pe provides the Scanner with an API for enumerating processes
  • eventBufSize determines the size of this event channel
  • logger provides the scanner with a logger

func (*Scanner) ProcessAddEventListener

func (s *Scanner) ProcessAddEventListener() <-chan uint32

ProcessAddEventListener returns a channel on which subscribers can listen for new process events. Scanner does not broadcast events to all subscribers; only one will be notified of a given change.

func (*Scanner) ProcessRemoveEventListener

func (s *Scanner) ProcessRemoveEventListener() <-chan uint32

ProcessRemoveEventListener returns a channel on which subscribers can listen for close process events. Scanner does not broadcast events to all subscribers; only one will be notified of a given change.

func (*Scanner) Serve

func (s *Scanner) Serve()

Serve is responsible for running the process scanner

func (*Scanner) Stop

func (s *Scanner) Stop()

Stop closes the process scanner

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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