Skip to content

Latest commit

 

History

History
83 lines (59 loc) · 2.96 KB

File metadata and controls

83 lines (59 loc) · 2.96 KB

Bootstrapping

In this chapter we will explain the bootstrap process initiated in [bootstrap].

The primordial entities

Before we can start to create and perform actions, we must first install four primordial entities:

  1. A subject that will only be used to bootstrap the system to a point where we have real users (The system subject).

  2. An operation that allows the creation of other actions (The creator operation).

  3. A permission to allow the subject (created in The system subject) to call this operation (created in The system permissions).

  4. A transaction function that we can use to perform an operation (The operation transaction function).

The system subject

The system subject is created to perform certain actions that are not authorized by general users of the system. It is primarily used for bootstrapping the system and should not be used afterwards. It is similar to the Unix root user.

link:../../src/juxt/site/alpha/init.clj[role=include]

The creator operation

Next we install a single operation that enables the creation of all other actions.

Let’s examine the document that represents this operation:

The create-operation operation
link:../../src/juxt/site/alpha/init.clj[role=include]
  1. This rule allows our system subject to call this operation, if an explicit permission exists.

  2. This Malli schema restricts the URIs of new Operations. Again, this should be modified if necessary to correspond to a different base URI.

  3. This sets the :juxt.site.alpha/type attribute so that the document is treated as an operation.

The system permissions

The system subject cannot call the create-operation operation without being granted permission.

A permission is represented by a specific entity.

The initial system permissions
link:../../src/juxt/site/alpha/init.clj[role=include]
  1. This attribute tells Site this is a permission document

  2. This is the set of actions which the permission allows

  3. This purpose attribute must be included in every permission but is set to nil in most cases

  4. This attribute is what satisfies the rule in create-operation

The operation transaction function

When actions are performed which modify the database, they run in a transaction function.

XTDB requires that we register this transaction function before we call it.