HSM package provides a simple state chart library written in Go.

UML HSM

HSM package provides a simple state chart library written in Go.

Supported UML State Chart Features

Feature Implemented Test case
Simple state Yes door_test
Composite states Yes nesting_test
Sub machines No
Compound transition No
Fork No
Join No
Guards/Actions Yes lobby_test + various
Shallow/Deep history No
Exit/Entry points Yes error_test + various
Init/Final Yes various
Event deferral No
Terminate No
Choice Yes choice_test
Junction No
Do activity No
Connection point ref No
Protocol Machines No

Introduction

State machines are used to model the dynamic behavior of a model element, and more specifically, the event-driven aspects of the system's behavior (see Events and Signals). State machines are specifically used to define state-dependent behavior, or behavior that varies depending on the state in which the model element is in. Model elements whose behavior does not vary with its state of the element do not require state machines to describe their behavior (these elements are typically passive classes whose primary responsible is to manage data). In particular, state machines must be used to model the behavior of active classes that use call events and signal events to implement their operations (as transitions in the class's state machine).

Source: Guideline: Statechart Diagram

States

A state is a condition of an object in which it performs some task or waits for an event. An object may remain in a state for a finite amount of time. A state has several properties:

  • Name: A textual string which distinguishes the state from other states.
  • Entry/exit actions: Actions executed on entering and exiting the state.
  • Internal transitions: Transitions that are handled without causing a change in state.
  • Sub-states: The nested structure of a state.
  • Deferred events: TODO

Choice Pseudo-States

Realizes a dynamic conditional branch. It evaluates the guards of the triggers of its outgoing transitions to select only one outgoing transition.

Entry and Exit Actions

Entry and exit actions allow the same action to be dispatched every time the state is entered or left, respectively. Entry and exit actions enable this to be done cleanly, without having to explicitly put the actions on every incoming or outgoing transition explicitly.

Transitions

A transition is a relationship between two states indicating that an object in the first state will perform certain actions and enter a second state when a specified event occurs and specified conditions are satisfied. On such a change of state, the transition is said to 'fire'. Until the transition fires, the object is said to be in the 'source' state; after it fires, it is said to be in the 'target' state. A transition has several properties:

  • Source state: The state affected by the transition; if an object is in the source state, an outgoing transition may fire when the object receives the trigger event of the transition and if the guard condition, if any, is satisfied.
  • Event trigger: The event that makes the transition eligible to fire (providing its guard condition is satisfied) when received by the object in the source state.
  • Guard condition: A boolean expression that is evaluated when the transition is triggered by the reception of the event trigger; if the expression evaluates True, the transition is eligible to fire; if the expression evaluates to False, the transition does not fire. If there is no other transition that could be triggered by the same event, the event is lost.
  • Effect: An executable atomic computation that may directly act upon the object that owns the state machine, and indirectly on other objects that are visible to the object.
  • Target state: The state that is active after the completion of the transition.

Signals

In the context of the state machine, a Signal is an occurrence of a stimulus that can trigger a state transition. Signals may include the passing of time, or a change in state. A signal or call may have parameters whose values are available to the transition, including expressions for the guard conditions and action. It is also possible to have a signal-less transition, represented by a transition with no signal trigger. These transitions, also called completion transitions, are triggered implicitly when its source state has completed its actions.

Guards

Transition guard conditions are evaluated after the signal for the transition occurs. It is possible to have multiple transitions from the same source state and with the same signal trigger, as long as the guard conditions don't overlap. A guard condition is evaluated just once for the transition at the time the signal occurs. The boolean MUST be side-effect free, at least none that would alter evaluation of other guards having the same trigger.

Effects

A transition effect is an executable atomic computation, meaning that it cannot be interrupted by an event and therefore runs to completion. Effects may include operation calls (to the owner of the state machine as well as other visible objects), the creation or destruction of another object, or the sending of a signal to another object.

Internal Transitions

Are those that may have an effect but not a change of state. Internal transitions allow signals to be handled within the state without leaving the state, thereby avoiding triggering entry or exit actions. Internal transitions may have guard conditions, and essentially represent interrupt-handlers.

Concepts

Events and Signals

An event is the specification of a significant occurrence that has a location in time and space. A 'signal' is a kind of event that represents the specification of an asynchronous stimulus between two instances.

Owner
Chris Castro
IT professional with vast experience in web technologies, an effective team worker and defender of OpenSource philosophy.
Chris Castro
Similar Resources

fswatch, this library could help watching filesystem changes, like macOS fswatch

fswatch go library for simple UNIX file system watching fswatch provides simple UNIX file system watching in Go. It is based around the Watcher struct

Jan 7, 2022

A charts library for Golang

A charts library for Golang

go-charts go-charts基于go-chart生成数据图表,无其它模块的依赖纯golang的实现,支持svg与png的输出,Apache ECharts在前端开发中得到众多开发者的认可,go-charts兼容Apache ECharts的配置参数,简单快捷的生成相似的图表(svg或png

Dec 29, 2022

Gfx - Golang file system extension library

Gfx - Golang file system extension library

gfx Golang文件操作扩展库,包含工作和生活中关于文件操作的各种有用的使用方法,包括 更友好的API 文件创建 文件删除 文件复制 一切皆可配置 文件名

Mar 10, 2022

State observer - StateObserver used to synchronize the local(cached) state of the remote object with the real state

state observer StateObserver used to synchronize the local(cached) state of the

Jan 19, 2022

🔐 Wrap keys from HSM using CKM_RSA_AES_KEY_WRAP step by step

🔐 pkcs11-key-wrap Wrap keys from HSM using CKM_RSA_AES_KEY_WRAP step by step. This tool can be used for example for exporting keys from Amazon's Clou

Aug 15, 2022

Us-api: a simple service that returns the US state code based on the state

us-api us-api is a simple service that returns the US state code based on the state. It does not support creating, updating nor deleting data. Local D

Dec 13, 2021

cluster-api-state-metrics (CASM) is a service that listens to the Kubernetes API server and generates metrics about the state of custom resource objects related of Kubernetes Cluster API.

Overview cluster-api-state-metrics (CASM) is a service that listens to the Kubernetes API server and generates metrics about the state of custom resou

Oct 27, 2022

go chart is a basic charting library in native golang.

go chart is a basic charting library in native golang.

Package chart is a very simple golang native charting library that supports timeseries and continuous line charts.

Jan 9, 2023

go chart is a basic charting library in native golang.

go chart is a basic charting library in native golang.

go-chart Package chart is a very simple golang native charting library that supports timeseries and continuous line charts. Master should now be on th

Dec 30, 2022

Find out where you fall on the Open-Source Character Alignment Chart

gitaligned Find out where you fall on the Open-Source Character Alignment Chart Binaries available in releases. If you prefer to install from source,

Dec 28, 2022

A helm v3 plugin to adopt existing k8s resources into a new generated helm chart

helm-adopt Overview helm-adopt is a helm plugin to adopt existing k8s resources into a new generated helm chart, the idea behind the plugin was inspir

Dec 15, 2022

Creates Helm chart from Kubernetes yaml

Helmify CLI that creates Helm charts from kubernetes yamls. Helmify reads a list of supported k8s objects from stdin and converts it to a helm chart.

Dec 28, 2022

An example microservice demo using kubernetes concepts like deployment, services, persistent volume and claims, secrets and helm chart

Docker vs Kubernetes Docker Kubernetes container tech, isolated env for apps infra management, multiple containers automated builds and deploy apps -

Dec 13, 2021

Data visualization with chart, Create CSV file, Read Write CSV file

Data visualization with chart, Create CSV file, Read Write CSV file, Read from json file and many more in single project ......

Jan 13, 2022

Stock chart + gxui

chartgxui Stock chart + gxui This application is privacy practice example and non-commercial use. It has only limited experience of dealing with marke

Feb 14, 2022

Katenary - Convert docker-compose to a configurable helm chart

Katenary - Convert docker-compose to a configurable helm chart

Katenary is a tool to help transforming docker-compose files to a working Helm C

Dec 23, 2022

Package mafsa implements Minimal Acyclic Finite State Automata in Go, essentially a high-speed, memory-efficient, Unicode-friendly set of strings.

MA-FSA for Go Package mafsa implements Minimal Acyclic Finite State Automata (MA-FSA) with Minimal Perfect Hashing (MPH). Basically, it's a set of str

Oct 27, 2022

Package fsm allows you to add finite-state machines to your Go code.

fsm Package fsm allows you to add finite-state machines to your Go code. States and Events are defined as int consts: const ( StateFoo fsm.State =

Dec 9, 2022

Metrics package helps to create ydb-go-sdk traces with monitoring internal state of driver

metrics metrics package helps to create ydb-go-sdk traces with monitoring internal state of driver Usage import ( "fmt" "sync/mutex" "time

Jan 7, 2023
Data visualization with chart, Create CSV file, Read Write CSV file

Data visualization with chart, Create CSV file, Read Write CSV file, Read from json file and many more in single project ......

Jan 13, 2022
Stock chart + gxui

chartgxui Stock chart + gxui This application is privacy practice example and non-commercial use. It has only limited experience of dealing with marke

Feb 14, 2022
Interactive Terraform visualization. State and configuration explorer.
Interactive Terraform visualization. State and configuration explorer.

Rover - Terraform Visualizer Rover is a Terraform visualizer. In order to do this, Rover: generates a plan file and parses the configuration in the ro

Jan 9, 2023
entviz is an ent extension that provides visualization of the schema graph
entviz is an ent extension that provides visualization of the schema graph

entviz entviz is an ent extension that creates visual graph (html file) of your ent's schema. install go get github.com/hedwigz/entviz add this exten

Dec 9, 2022
Go package for writing descriptions using the Graphviz DOT language
Go package for writing descriptions using the Graphviz DOT language

dot - little helper package in Go for the graphviz dot language

Nov 30, 2022
termdbms: A TUI for viewing and editing databases, written in Go
 termdbms: A TUI for viewing and editing databases, written in Go

termdbms: A TUI for viewing and editing databases, written in Go Database Support SQLite made with modernc.org/sqlite, charmbracelet/bubbletea, and c

Dec 26, 2022
🎨 The adorable charts library for Golang
🎨 The adorable charts library for Golang

go-echarts ?? The adorable charts library for Golang. If a language can be used to build web scrapers, it definitely needs to provide a graceful data

Dec 30, 2022
3D Wireframe Drawing Library for Go
3D Wireframe Drawing Library for Go

pinhole 3D Wireframe Drawing Library for Go Javascript Version Demo Why does this exist? I needed a CPU based 3D rendering library with a very simple

Dec 10, 2022
go-echarts 🎨 The adorable charts library for Golang
go-echarts 🎨 The adorable charts library for Golang

go-echarts ?? The adorable charts library for Golang. If a language can be used to build web scrapers, it definitely needs to provide a graceful data

Jan 4, 2023
Ltree Visualizer - A golang library to visualize postgres ltree type data using DOT language and Graphviz
Ltree Visualizer - A golang library to visualize postgres ltree type data using DOT language and Graphviz

Ltree Visualizer A golang library to visualize postgres ltree type data using DOT language and Graphviz What is Ltree? Ltree is a data type which is u

Jun 12, 2022