Clarify documentation for Actor
This commit is contained in:
parent
b12ffdb0a0
commit
e0c8825949
26
actor.go
26
actor.go
@ -3,17 +3,29 @@ package camfish
|
|||||||
import "context"
|
import "context"
|
||||||
|
|
||||||
// Actor is a participant in the environment. All public methods on an actor
|
// Actor is a participant in the environment. All public methods on an actor
|
||||||
// must be safe for concurrent use by multiple goroutines. Additionally, any
|
// should be safe for concurrent use by multiple goroutines except for AddFlags,
|
||||||
// type which explicitly implements Actor should:
|
// Init, Configure, and ProcessConfig. Additionally, any type which explicitly
|
||||||
|
// implements Actor should:
|
||||||
|
//
|
||||||
// - Treat all public fields, values, indices, etc. as immutable
|
// - Treat all public fields, values, indices, etc. as immutable
|
||||||
// - Satisfy Actor as a pointer, not a value
|
// - Satisfy Actor as a pointer, not a value
|
||||||
// - Not have a constructor
|
// - Not have a constructor
|
||||||
|
//
|
||||||
|
// The CAMFISH environment will use interfaces in this package to probe actors
|
||||||
|
// for methods. If an actor is supposed to fulfill one of these interfaces, this
|
||||||
|
// should be enforced at compile-time by assigning the actor to an anonymous
|
||||||
|
// global variable of that interface type. For instance, this line will ensure
|
||||||
|
// that SomeActor fulfills [Resettable]:
|
||||||
|
//
|
||||||
|
// var _ camfish.Resettable = new(SomeActor)
|
||||||
type Actor interface {
|
type Actor interface {
|
||||||
// Type returns the type name of the actor. The value returned from this
|
// Type returns the "type name" of the actor. The value returned from
|
||||||
// is used to locate actors capable of performing a specific task, so it
|
// this is used to locate actors capable of performing a specific task,
|
||||||
// absolutely must return the same string every time. Actors implemented
|
// so it absolutely must return the same string every time. It is
|
||||||
// in packages besides this one (i.e. not camfish) must not return the
|
// usually best to have this be unique to each actor. Actors implemented
|
||||||
// string "cron".
|
// in packages other than this one
|
||||||
|
// (git.tebibyte.media/sashakoshka/camfish) must not return the string
|
||||||
|
// "cron".
|
||||||
Type() string
|
Type() string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user