Skip to main content

Instructions

Instructions are small, versatile pieces of code that execute in response to data changes or at regular intervals within Hivekit. They can be compared to AWS Lambda Functions or logic written into business rules engines..

Written in a straightforward language called HiveScript, instructions consist of two parts: 'when' and 'then'. The 'when' part identifies the triggering conditions and/or the objects involved in the instruction, while the 'then' part defines actions, sets data, or performs other functions.

Instructions possess inherent statefulness. The 'when' part generates a set of objects, object pairs, or other values, and the 'then' part operates only on entries that have been added or removed from the set.

To delve deeper into the workings of instructions, refer to the introduction to HiveScript .

Applications of Instructions

Instructions have diverse applications, similar to any other programming environment:

  • Visualizations: For instance, in a taxi dispatch scenario, you may want to ensure a minimum of 20 drivers in each city district. An instruction can count the drivers and adjust the district's area color accordingly.

  • Alerts: In a large construction site with multiple security zones and varying access permissions, instructions can be used to create an alert mechanism that notifies both the employee and the supervisor if someone enters a restricted area without clearance.

  • Business Processes: In an e-scooter-sharing company, instructions can help guide the optimally positioned maintenance truck to the nearest group of scooters requiring charging.

  • Machine Control: For example, in a mining operation, on-demand ventilation and elevator call systems can be managed through instructions, ensuring efficient use of resources.

HiveScript: A Simplified Language

HiveScript is not a full-fledged programming language. It is simpler than most structured query languages (SQL) or domain-specific languages. The aim of HiveScript is to provide a user-friendly syntax for filtering objects and executing actions in response to changes.

Meta-Data for Instructions

Like all other concepts in Hivekit, instructions can be associated with arbitrary meta-data, making it easy to store information about the instruction's creator, display preferences, or deletion protection status.