Top 0.9% dependent packages on proxy.golang.org
Top 0.9% dependent repos on proxy.golang.org
Top 3.1% forks on proxy.golang.org
Top 0.4% docker downloads on proxy.golang.org
proxy.golang.org : github.com/thejerf/suture
Package suture provides Erlang-like supervisor trees. This implements Erlang-esque supervisor trees, as adapted for Go. This is an industrial-strength, tested library deployed into hostile environments, not just a proof of concept or a toy. If you are reading this, you are reading the documentation for the v3 version, which is not the latest. If you want the latest v4, be sure to be using github.com/thejerf/suture/v4. This rewrites the API to be in terms of contexts. Supervisor Tree -> SuTree -> suture -> holds your code together when it's trying to fall apart. Why use Suture? Suture has 100% test coverage, and is golint clean. This doesn't prove it free of bugs, but it shows I care. A blog post describing the design decisions is available at http://www.jerf.org/iri/post/2930 . To idiomatically use Suture, create a Supervisor which is your top level "application" supervisor. This will often occur in your program's "main" function. Create "Service"s, which implement the Service interface. .Add() them to your Supervisor. Supervisors are also services, so you can create a tree structure here, depending on the exact combination of restarts you want to create. As a special case, when adding Supervisors to Supervisors, the "sub" supervisor will have the "super" supervisor's Log function copied. This allows you to set one log function on the "top" supervisor, and have it propagate down to all the sub-supervisors. This also allows libraries or modules to provide Supervisors without having to commit their users to a particular logging method. Finally, as what is probably the last line of your main() function, call .Serve() on your top level supervisor. This will start all the services you've defined. See the Example for an example, using a simple service that serves out incrementing integers.
Registry
-
Source
- Documentation
- JSON
purl: pkg:golang/github.com/thejerf/suture
License: MIT
Latest release: 5 months ago
First release: over 9 years ago
Namespace: github.com/thejerf
Dependent packages: 32
Dependent repositories: 37
Stars: 1,179 on GitHub
Forks: 64 on GitHub
Docker dependents: 8
Docker downloads: 6,157,230
See more repository details: repos.ecosyste.ms
Last synced: about 9 hours ago