Ecosyste.ms: Packages

An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 8.2% on proxy.golang.org

proxy.golang.org : github.com/reiver/go-toilfork

Package toilfork provides simple functionality for managing a group of toilers (i.e., workers) where each toiler in the group is basically the "same" toiler. In this use case, the toilers are all created from a single toiler creation func or interface that is registered when creating the toilfork group is created. To use, create one or more types that implement the toilfork.Toiler interface. For example: Then create a toilfork.ToilForker. For example: (Note that there is also the toilfork.New() func too, that could be used instead of this.) Then fork off one of more toilers (i.e., types that implement the toil.Toiler interface) by calling the toil forker's Fork method. For example: Then you can call the Toil method of the toil forker, and it will cause all the toilers inside of it to start toiling (by calling each of their Toil methods). For example: A toiler's Toil method can finish in one of two ways. Either it will return gracefully, or it will panic(). The toil forker is OK with either. But also, the toil forker provides the toiler with a convenient way of being notified of each case. If a toiler also has a Terminated() method, then the toil forker will call the toiler's Terminated() method when the toiler's Toil() method has returned gracefully. For example: If a toiler also has a Recovered() method, then the toil forker will call the toiler's Recovered() method when the toiler's Toil() method has panic()ed. For example: And of course, a toiler can take advantage of both of these notifications and have both a Recovered() and Terminated() method. For example:

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/reiver/go-toilfork
License: MIT
Latest release: over 8 years ago
First release: over 8 years ago
Namespace: github.com/reiver
Last synced: 5 days ago

    Loading...
    Readme
    Loading...