Versions in this module Expand all Collapse all v0 v0.2.1 Aug 5, 2019 v0.2.0 Jul 29, 2019 Changes in this version + const DefaultPoolTimeout + func Is(err error, code ErrCode) bool + type Cfg struct + Finish []string + Places []string + Start string + Transitions map[string]CfgTransition + type CfgTransition struct + From []string + To []string + type Consumer interface + AfterPlace func(placeID string) + AfterTransit func(transitionID string) + BeforePlace func(placeID string) error + BeforeTransit func(transitionID string) error + CanTransit func(transitionID string) bool + type ErrCode int + const ErrCodeBeforePlaceReturnedErr + const ErrCodeBeforeTransitReturnedErr + const ErrCodeCantSetErrState + const ErrCodeConsumerNotSet + const ErrCodeFinished + const ErrCodeFromTransitionAlreadyRegistered + const ErrCodeHasNotChipForNewPlace + const ErrCodeNetInErrState + const ErrCodePlaceAlreadyRegistered + const ErrCodePlaceIsNotRegistered + const ErrCodePoolAlreadyInit + const ErrCodeToTransitionAlreadyRegistered + const ErrCodeTransitionAlreadyRegistered + const ErrCodeUnexpectedAvailableTransitionsNumber + const ErrCodeWaitingForNetFromPoolTooLong + type Error struct + Code ErrCode + Message string + func NewError(errorCode ErrCode, msg string) *Error + func NewErrorf(errorCode ErrCode, format string, args ...interface{}) *Error + func (e *Error) Error() string + func (e *Error) Is(errorCode ErrCode) bool + type Factory struct + func NewFactory(cfg Cfg, consumer Consumer, numberOfPrepared int) *Factory + func (f *Factory) Get() *Net + func (f *Factory) Run() error + type Net struct + func BuildFromCfg(cfg Cfg) (*Net, error) + func New() *Net + func (c *Net) AddPlace(place *Place) error + func (c *Net) AddTransition(transition *Transition) error + func (c *Net) AsGraphvizDotLang(name string, withState bool) (string, error) + func (c *Net) FullReset() + func (c *Net) GetErrFromState() *Error + func (c *Net) GetPlace(placeID string) (*Place, error) + func (c *Net) GetState() State + func (c *Net) IsErrState() bool + func (c *Net) IsFinished() bool + func (c *Net) SetConsumer(l Consumer) + func (c *Net) SetErrorState(err *Error) error + func (c *Net) SetPlace(placeID string) error + func (c *Net) SetStartPlace(place string) error + func (c *Net) StartPlace() error + func (c *Net) UpFromState(state State) + type Place struct + FromTransition *Transition + ID string + IsFinished bool + ToTransitions []*Transition + func NewPlace(id string, isFinished bool) *Place + func (s *Place) AddToTransitions(transition *Transition) error + func (s *Place) SetFromTransition(transition *Transition) error + type Pool struct + func NewPool(size int, getTimeout time.Duration) *Pool + func (p *Pool) Get() (*PoolNet, error) + func (p *Pool) Init(cfg Cfg) error + type PoolNet struct + func (n *PoolNet) Close() + type State struct + Err *Error + Finished bool + PlaceChips map[string]int + TransitionChips map[string]int + func (s State) IsError() bool + func (s State) IsFinished() bool + type Transition struct + FromPlaces []*Place + ID string + ToPlaces []*Place