Data model
The Factory+ object model
How Factory+ identifies every thing by UUID and classifies it with ranked classes, membership and subclass relations, and an owner.
The object model is the set of rules Factory+ uses to identify things by UUID and sort them into classes.
Every thing that Factory+ knows about has a UUID. It might be a device, a person, an application, a permission or a schema. Because services pass these UUIDs to each other constantly, they need a shared answer to two questions about any UUID: what kind of thing is this, and which groups is it part of? The object model answers both with a small set of rules for classifying objects into classes. The same model serves every caller, whether that is the Auth service expanding a grant on a group of devices, an Edge Agent finding its configuration or the i3X interface building a type hierarchy.
The Configuration Store holds the object model, and the Configuration Store page describes the API that reads and changes it.
Notation
Set notation is used where it makes the rules shorter.
| Notation | Meaning |
|---|---|
| Name in italics | The name of an object. |
| Member ∈ Class | Member is a member of Class. |
| Subclass ⊂ Superclass | Subclass is a subclass of Superclass. |
| 𝒫 Class | The power set of Class (see Power sets and naming). |
Objects, individuals and classes
An object is anything with a Factory+ UUID. Every object is a member of at least one class. It may be a member of any number of classes.
A class is a collection of objects. For any object at all, it must be possible to decide whether the object is in the class. The members do not need anything else in common. A class is defined entirely by its members. Two classes with the same members are therefore the same class under two names.
An individual is an object that is not a class. Physical things such as a machine or a sensor are individuals. Many things that are not physical are individuals too, such as a permission or a config schema.
Every class in Factory+ is also an object, so it has a UUID. Apart from the top rank superclass described below, every class is itself a member of a class. This lets the model state facts such as “Central service is a kind of Principal”. Central service is a class whose members are principals, and it is also a member of the class Principal type.
Ranks
The rank of an object says how deeply it is nested. Individuals have rank 0. A rank 1 class contains only individuals. A rank 2 class contains only rank 1 classes, and a rank 3 class contains only rank 2 classes. Factory+ uses ranks 0 to 3 for ordinary objects.
The rank rules are:
- A member is always exactly one rank below the class it belongs to.
- A subclass always has the same rank as its superclass.
- An individual cannot be a subclass of anything.
- A class cannot contain objects of mixed rank.
Under these rules no class can be a member of itself. A class that could contain itself leads to classes where membership cannot be decided, and that breaks the definition of a class above.
Rank superclasses
Each rank has a well-known class that contains every object of that rank. These are the rank superclasses.
| Class | Rank of the class | Contains | UUID |
|---|---|---|---|
| Individual | 1 | Every individual (rank 0) | 2494ae9b-cd87-4c01-98db-437a303b43e9 |
| Rank 1 class | 2 | Every rank 1 class | 04a1c90d-2295-4cbe-b33a-74eded62cbf1 |
| Rank 2 class | 3 | Every rank 2 class | 705888ce-53fa-434d-afee-274b331d4642 |
| Rank 3 class | 4 | Every rank 3 class | 52b80183-6998-4bf9-9b30-132755e7dede |
Every class is a subclass of the rank superclass for its rank, either directly or through other classes. Every rank 1 class is a subclass of Individual, every rank 2 class is a subclass of Rank 1 class, and so on. A class that has no other superclass is a direct subclass of its rank superclass.
Rank 1 class is the power set of Individual, and the same holds one rank up. In principle the series continues for ever, but only these four are defined. Rank 3 class is the top of the hierarchy. It is the one object with no primary class, because the class it would belong to has no UUID. A Configuration Store MUST provide all four rank superclasses with these UUIDs. A higher rank would need a new well-known UUID and a change to every implementation.
Membership and subclasses
Two relations connect objects to classes.
- Membership. X ∈ C means X is one of the objects that make up C.
- Subclass. A ⊂ B means every member of A is also a member of B. Every class is a subclass of itself.
Membership follows subclasses upwards. If X ∈ A and A ⊂ B, then X ∈ B. Subclass relations chain in the same way. If A ⊂ B and B ⊂ C, then A ⊂ C.
Direct and derived relations
A relation that is recorded explicitly is a direct relation. A relation that follows from direct relations by the rules above is a derived relation. A Configuration Store MUST expand direct relations recursively, so that queries for the members or subclasses of a class return derived relations as well as direct ones.
For example, take these direct relations:
X ⊂ Y A ⊂ X B ∈ X C ∈ A
A query for the members and subclasses of Y also returns these derived relations:
A ⊂ Y B ∈ Y C ∈ Y
Clients MUST NOT attach any meaning to whether a relation is direct or derived. Direct relations are editing information that records how the classification was built up. Reading them therefore needs the permission to change them. A client with read-only access sees only the derived relations.
A direct subclass relation that becomes redundant is removed by the Configuration Store. Suppose A ⊂ B and C ⊂ B are direct, and A ⊂ C is added. The direct relation A ⊂ B is then removed. It still holds as a derived relation through C, so no query result changes.
Primary class
Every object except Rank 3 class has one primary class, recorded in its Registration entry. The primary class is the class the object was created in. It tells a human what sort of thing the object is, and user interfaces commonly show it next to the object’s name.
Because an object is always a member of its primary class, a Configuration Store MUST refuse a change that would remove that membership. Apart from that, the primary class has no special meaning. Machines SHOULD decide what an object is by testing its membership of the classes they care about, not by reading its primary class.
Power sets and naming
The power set of a class A, written 𝒫 A, is the class of all subclasses of A. It contains A itself and is one rank higher than A. The Configuration Store does not create or maintain power sets, but the idea explains two naming conventions.
Class names are singular and describe one member. The class of all principals is Principal, not Principals. The words group, set, type and kind in a class name normally mean it is a class of classes, and two of them have a more exact meaning.
- Foo group normally means 𝒫 Foo, the class of all collections of Foos.
- Foo type normally means a partition of Foo. This is a subclass of 𝒫 Foo in which every member of Foo belongs to exactly one member of Foo type.
The principal classes that the Auth service uses follow this pattern.
flowchart BT
user["Human user<br/>(rank 1)"]
central["Central service<br/>(rank 1)"]
principal["Principal<br/>(rank 1)"]
ptype["Principal type<br/>(rank 2)"]
pgroup["Principal group<br/>(rank 2)"]
user -- "⊂" --> principal
central -- "⊂" --> principal
user -. "∈" .-> ptype
central -. "∈" .-> ptype
principal -. "∈" .-> pgroup
ptype -- "⊂" --> pgroup
Each principal is an individual and a member of Principal. Human user and Central service are subclasses of Principal, so every human user is also a principal. They are also members of Principal type, because each principal is exactly one kind of principal. Principal group holds collections of principals, and Principal is a member of it. Principal type is a subclass of Principal group, because every principal type is also a collection of principals.
| Class | UUID |
|---|---|
| Principal | 11614546-b6d7-11ef-aebd-8fbb45451d7c |
| Principal group | c0157038-ccff-11ef-a4db-63c6212e998f |
| Principal type | ae17afe0-ccff-11ef-bb70-67807cb4a9df |
| Human user | 8b3e8f35-78e5-4f93-bf21-7238bcb2ba9d |
| Central service | e463b4ae-a322-46cc-8976-4ba76838e908 |
Applications are classes too
Configuration lives in the same model. An application is a UUID under which the Configuration Store keeps one JSON config entry per object. Each application is an object of the class Application (d319bd87-f42b-4b66-be4f-f82ff48b93f0), which is a rank 2 class. An application is therefore a rank 1 class, and its config entries can be thought of as its members. Applications are grouped into classes in the same way as any other objects, and this lets a single grant cover a set of related applications.
Names
The object model itself has no names. A human-readable name for an object is held in the General Information application (64a8bfa9-7772-45c4-9d1a-9e6290690957). Its entry has a required name string and optional location, photo and contact fields. Names are for people, and a client MUST NOT identify an object by its name.
Registration
Every object has exactly one Registration entry. It is a config entry of the Object Registration application (cb40bed5-49ad-4443-a7f5-08c75009da8f) and records the facts the model needs about the object.
| Field | Type | Meaning |
|---|---|---|
uuid | UUID | The object’s UUID. It cannot change. |
rank | integer | 0 for an individual, 1 to 3 for a class. |
class | UUID | The primary class. Its rank is always one more than rank. |
owner | UUID | The principal that owns the object, or Unowned. |
deleted | boolean | True if the object has been soft-deleted. |
strict | boolean | Always true. Reserved so that a later version can allow classes of mixed rank. |
The Configuration Store creates the Registration entry when the object is registered and keeps it in step with the object. The entry is the authoritative record of rank, primary class and owner. Clients change these by writing to the entry, and the Configuration Store applies or refuses each change as follows.
uuidcannot change. A request that changes it MUST be refused.classwith the same rank changes the primary class. The new class MUST be one rank above the object. The object becomes a member of the new class if it is not one already. It stays a member of its old primary class until that membership is removed separately.rankcan only change to or from 0. The request MUST changeclassto a class of the right rank at the same time. Re-ranking is destructive because the object loses all its current memberships and superclasses and becomes a member of its new primary class only. If it is now a class, it also becomes a subclass of its new rank superclass. A class can only become an individual if it has no members and no subclasses.ownerchanges ownership, under the rules in Ownership.deletedmarks the object as deleted or brings it back.
A Registration entry cannot be deleted on its own. It goes only when the object itself is deleted.
Ownership
Every object’s owner is the UUID of a principal or the special object Unowned (091e796a-65c0-4080-adff-c3ce01a65b2e). Ownership lets a principal manage the objects it created without a grant on each one. A plural grant on the special target Mine covers every object the principal owns, as described in Ownership, Mine and Unowned.
Ownership changes hands through two permissions, each checked against a principal.
- Take from (
6ad67652-5009-11f0-9404-73b79124c3d5), with the current owner as target, allows taking an object away from that owner. - Give to (
4eaab346-4d1e-11f0-800e-dfdc061c6a63), with the new owner as target, allows handing an object to that owner.
Changing an owner needs both permissions. Registering a new object with an owner needs Give to on that owner. Every principal implicitly has Take from on itself, and Give to on itself and on Unowned. A principal can therefore always pass its own objects to Unowned. It can also always register new objects that it owns itself or that nobody owns.
If a client registers an object without naming an owner, the Configuration Store SHOULD make the calling principal the owner. If the store cannot work out the caller’s principal UUID, it refuses the request. The new owner MUST be a registered object.
Soft and hard delete
A UUID that has been used should stay registered for ever, because other systems may hold it and a new object must never reuse it. The normal way to remove an object is therefore a soft delete, which sets deleted to true in its Registration entry. The object keeps its UUID, classes and config. Clients SHOULD treat a soft-deleted object as gone. Registering the same UUID again sets deleted back to false.
A hard delete removes the object and every config entry about it. A Configuration Store MUST refuse a hard delete while the object still has direct members or direct subclasses. It MUST also refuse a hard delete of an application that still has config entries stored under it. It MUST refuse to delete the objects the store itself depends on. The API details are under Deleting objects on the Configuration Store page.
Well-known UUIDs
These objects are part of the model itself. A Configuration Store MUST provide them.
2494ae9b-cd87-4c01-98db-437a303b43e904a1c90d-2295-4cbe-b33a-74eded62cbf1705888ce-53fa-434d-afee-274b331d464252b80183-6998-4bf9-9b30-132755e7deded319bd87-f42b-4b66-be4f-f82ff48b93f0ddb132e4-5cdd-49c8-b9b1-2f35879eab6d00000000-0000-0000-0000-000000000000091e796a-65c0-4080-adff-c3ce01a65b2ecb40bed5-49ad-4443-a7f5-08c75009da8f64a8bfa9-7772-45c4-9d1a-9e62906909574eaab346-4d1e-11f0-800e-dfdc061c6a636ad67652-5009-11f0-9404-73b79124c3d5The Configuration Store page lists every Configuration Store UUID, including the permissions that control class edits. They are also in Well-known UUIDs.