cirello-io / oversight

Erlang-like supervisor trees

Home Page:https://cirello.io/oversight

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cirello.io/oversight

Go Reference

Package oversight makes a complete implementation of the Erlang supervision trees.

Refer to: http://erlang.org/doc/design_principles/sup_princ.html

go get [-u -f] cirello.io/oversight

https://godoc.org/cirello.io/oversight

Quickstart

supervise := oversight.New(
	oversight.Processes(func(ctx context.Context) error {
		select {
		case <-ctx.Done():
			return nil
		case <-time.After(time.Second):
			log.Println(1)
		}
		return nil
	}),
)

ctx, cancel := context.WithCancel(context.Background())
defer cancel()
if err := supervise.Start(ctx); err != nil {
	log.Fatal(err)
}

About

Erlang-like supervisor trees

https://cirello.io/oversight

License:Apache License 2.0


Languages

Language:Go 100.0%