Document RunShutdownable in Run

This commit is contained in:
Sasha Koshka 2025-01-30 18:28:16 -05:00
parent 2cb1e5cb3a
commit b4c55decc6

33
run.go
View File

@ -9,7 +9,7 @@ var env environment
// when all running actors have stopped. Error and log messages will be printed.
// The correct way to use this function is to have it be the only thing in main:
//
// func main () {
// func main() {
// camfish.Run("name", "what it does", new(SomeActor), new(AnotherActor))
// }
//
@ -50,21 +50,22 @@ var env environment
// is configurable, but by default it is 8 minutes. The vast majority of
// actors should initialize in under 100 milliseconds.
//
// 70. Running: Actors which implement [Runnable] are run, each in their own
// goroutine. The environment is able to restart actors which have failed,
// which entails resetting the actor if it implements [Resettable], and
// running the actor again within the same goroutine. If an actor does not
// run for a meaningful amount of time after resetting/initialization
// before failing, it is considered erratic and further attempts to restart
// it will be spaced by a limited, constantly increasing time interval. The
// timing is configurable, but by default the threshold for a meaningful
// amount of runtime is 16 seconds, the initial delay interval is 8
// seconds, the interval increase per attempt is 8 seconds, and the maximum
// interval is one hour. Additionally, programs which implement [Trimmable]
// will be trimmed regularly whenever they are running. The trimming
// interval is also configurable, but by default it is once every minute.
// When an actor which implements [Resettable] is reset, it is given a
// configurable timeout, which is 8 minutes by default.
// 70. Running: Actors which implement [Runnable] or [RunShutdownable] are
// run, each in their own goroutine. The environment is able to restart
// actors which have failed, which entails resetting the actor if it
// implements [Resettable], and running the actor again within the same
// goroutine. If an actor does not run for a meaningful amount of time
// after resetting/initialization before failing, it is considered erratic
// and further attempts to restart it will be spaced by a limited,
// constantly increasing time interval. The timing is configurable, but by
// default the threshold for a meaningful amount of runtime is 16 seconds,
// the initial delay interval is 8 seconds, the interval increase per
// attempt is 8 seconds, and the maximum interval is one hour.
// Additionally, programs which implement [Trimmable] will be trimmed
// regularly whenever they are running. The trimming interval is also
// configurable, but by default it is once every minute. When an actor
// which implements [Resettable] is reset, it is given a configurable
// timeout, which is 8 minutes by default.
//
// 80. Shutdown: This can be triggered by all actors being removed from the
// environment, a catastrophic error, [Done] being called, or the program