Skip to main content

Dependencies

Introduction

A dependency is the edge between two nodes that describes their relationship. It can be one of three types,

  • Parent
    A node is the parent of another node, meaning it must exist before the child node is created. For example, an app is the parent of a region, so the app must exist before any region is created.
  • Child
    A node is the child of another node, meaning it will be deleted before the parent node is deleted. For example, an environment is a child of a region, so all environments must be deleted before deleting the region.
  • Relationship
    A node has a relationship with another node that is neither a parent nor a child relationship. For example, a server has a relationship with an image. The distinction between the "relationship" type and the "parent-child" type is that in a "relationship", there is no obligation for either node to exist or be deleted before of the other node.
tip
  • A parent-child dependency is bi-directional, i.e. if Node 1 is parent of Node 2, then Node 2 must be a child of Node 1.
  • A "Relationship" dependency is also bi-directional, i.e. if Node 1 has relationship with Node 2, then Node 2 also has a relationship with Node 1.

Node

A node in Octo can be - a Model, a Resource, a Shared-Resource, or an Overlay.
In Octo code base, a node is represented with any child of AModel<I, T>, which is the base abstract class that Model, Resource, Shared-Resource, and Overlay inherit from.

info

The base class AModel is not to be confused with its concrete implementation Model class. The former is a low level implementation detail, vs the latter is a concrete concept.

Dependency Class

A dependency is not stored as a property in nodes; instead, it is its own class. It encompasses two nodes on its either end.

Dependency Schema
{
from: "a node",
to: "a node",
relationship: "parent | child | relationship",
behaviors: "an array of metadata with individual traits of this dependency."
}

A dependency is also serialized and deserialized like models and resources.
It is a first class citizen of Octo.

Summary

In a graph there are vetices and edges. In this section we learned that a Dependency represents an edge, and is stored as a first class citizen of Octo.