Proposal - mjohnstone357/Operations GitHub Wiki

Operations Project Proposal

Overview

Operations refers to an idea of a platform for hosting software applications and a set of tools for deploying and managing those applications. It is an ongoing experiment to see how to develop software which is easier to reason about and maintain.

Detail

Applications hosted on Operations will comprise one or more objects connected in a directed acyclic graph of data dependencies, where each object is either a function or a value.

A function takes zero or more input values (called parameters), and using a pure calculation produces one or more output values (called results). Each of a function’s inputs can be connected to another function’s output or to a value.

A value is an object containing data whose value does not depend on any other objects. Client processes can modify the application’s state by updating the application’s values from within a transaction.

There is a third type of entity available to programmers of Operations applications: the constraint. A constraint depends on one or more objects and/or constraints, and describes invariants involving those objects. Constraints are evaluated whenever one of their dependencies is changed, but all constraint evaluation is deferred until the end of the current transaction.

Each object depended upon by a constraint implements a method to handle violations of that constraint. These are called reconciliation handlers, and can act to correct the constraint violation or perform no operation.

If a constraint is not satisfied at the end of a transaction, the constraint’s reconciliation handlers are called in an order specified on the constraint. If the first reconciliation handler called fails to rectify the problem, or simply declines to, the second is called and so on. If all of the reconciliation handlers are called and the constraint is still not satisfied, then the transaction is rolled back and the incident is recorded.

Examples

Users’ reports

This example has three components:

  • AllReports - the set of all the reports in the system (a value)
  • MyReports - the set of reports belonging to the current user (a function)
  • CurrentUser - the currently logged-in user (a value)

MyReports depends on AllReports and CurrentUser. There are no other dependencies between the objects.

When a process wants to get all of the reports for a user, it sets the CurrentUser value to that user, and reads the return value of the MyReports function.

Disjoint Sets

This example has two components:

  • SetA - a set of some things
  • SetB - another set of things

It also has a constraint: DisjointSets. This Constraint depends upon SetA and SetB and asserts that no element which exists in SetA exists in SetB and vice versa. The DisjointSets constraint has a reconciliation order of {SetA, SetB}.

SetA’s method to handle an exception from DisjointSets is to pass.

SetB’s DisjointSets handler removes the conflicting element(s) from that set.

Therefore, if a process makes a change which results in an element being present in both sets, it is removed from SetB rather than escalated.

⚠️ **GitHub.com Fallback** ⚠️