track

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tracker

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

Tracker tracks integrations context while running so actions can be taken later on based on those. Integrations are identified by hash: name+args. Use cases: - command-api requests to stop an integration, for which PID and ctx cancellation are stored. - integrations run by command-api should notify their exit-code by submiting an event. In case we need to cover more cases, it'd be nice to decouple cases logic from the tracking one.

func NewTracker

func NewTracker(emitter dm.Emitter) *Tracker

NewTracker creates new integrations tracker. If an "emitter" is provided then an event will be submited containing the exit code of the integration execution.

func (*Tracker) Kill

func (t *Tracker) Kill(hash string) (stopped bool)

Kill cancels context, for a running process it'll be SIGKILLed.

func (*Tracker) NotifyExit

func (t *Tracker) NotifyExit(hash string, exitCode int)

func (*Tracker) PIDReadChan

func (t *Tracker) PIDReadChan(hash string) (pidReadChan <-chan int, tracked bool)

PIDReadChan returns a PID receiver channel of an stoppable process, nil is returned when not tracked.

func (*Tracker) Track

func (t *Tracker) Track(ctx context.Context, hash string, def *integration.Definition) (context.Context, chan<- int)

Track tracks (indexing by hash) an integration run alogn with its context and optionally Definition. When Definition is not provided NotifyExit method won't take any effect.

func (*Tracker) Untrack

func (t *Tracker) Untrack(hash string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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