Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Exclusive ¶
type Exclusive struct { Name string // contains filtered or unexported fields }
Exclusive is a data structure used to tracking and ensure only one instance of the go runner is active on a system at once
func NewExclusive ¶
NewExclusive is used to initialize a unix domain socket that ensure that only one runner process is active on a kubernetes pod or machine at the same time. If there are other processes active then it will return an error.
An example of a server that wishes to restrict itself to a single instance of a process would appear as follows:
func main() {
ctx, cancel := context.WithCancel(context.Background()) defer cancel() // This is the one check that does not get tested when the server is under test // if _, err := process.NewExclusive(ctx, "my-server"); err != nil { fmt.Fprintf(os.Sdterr, "An instance of this process is already running %s", err.Error()) os.Exit(-1) } … }
Click to show internal directories.
Click to hide internal directories.