Documentation
¶
Overview ¶
Package handler provides datastructures for handlers which can be used to abort potentially long-running computations in LogicNG. There are some standard handlers like timeout handler already implemented in LogicNG. If you need other criteria when to abort computations, you can implement the Handler interface yourself.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Computation ¶
type Computation struct {
// contains filtered or unexported fields
}
Computation is a simple computation handler which can be embedded in more complex handlers.
func (*Computation) Aborted ¶
func (c *Computation) Aborted() bool
Aborted reports whether the computation was aborted by the handler.
func (*Computation) SetAborted ¶
func (c *Computation) SetAborted(aborted bool)
SetAborted sets whether the computation was aborted.
func (*Computation) Started ¶
func (c *Computation) Started()
Started indicates the handler that the computation was started.
type Handler ¶
type Handler interface { Started() Aborted() bool }
A Handler can be used to abort computations. The Started method is called when the computation is started. The Aborted method returns whether the computation was aborted by the handler.
type Timeout ¶
type Timeout struct { Computation // contains filtered or unexported fields }
A Timeout handler is used to abort computations after a given time.
func NewTimeoutWithDuration ¶
NewTimeoutWithDuration generates a new timeout handler which aborts a computation after the given duration.
func NewTimeoutWithEnd ¶
NewTimeoutWithEnd generates a new timeout handler which aborts a computation at the given time.
func (*Timeout) TimeLimitExceeded ¶
TimeLimitExceeded reports whether the internal time limit of the handler was exceeded.