Skip to content
/ proc Public

proc is a package to help start and stop services

Notifications You must be signed in to change notification settings

zeebo/proc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

proc

import "github.com/zeebo/proc"

Usage

type Proc

type Proc interface {
	Start(ctx context.Context) error
	Wait() error
}

Proc represents something that can be started and stopped and possibly has some dependencies on other Procs.

type Node

type Node struct {
}

Node is a node in the DAG of Procs. It has a single Proc and a set of child Nodes that it manages.

func New

func New(proc Proc, children ...*Node) *Node

New wraps the Proc in a Node and ensures that when the returned Node is Run, all of the children are Run as well. The children are guaranteed to start after the parent, and exit before the parent.

func (*Node) Run

func (n *Node) Run(ctx context.Context) (err error)

Run starts the associated Proc, recursively starts its children, waits for its children to exit, then cancels and waits for its associated Proc. There can only be one call to Run executing at a time.

About

proc is a package to help start and stop services

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages