{
  "code": null,
  "collection": "architecture",
  "href": "https://banes-lab.com/ontology#architecture-vector-clocks",
  "id": "vector-clocks",
  "kind": "mechanism",
  "layer": {
    "href": "https://banes-lab.com/ontology/schema#layer-causality-core",
    "json": "https://banes-lab.com/json/records/layer/causality-core",
    "label": "Causality Core",
    "markdown": "https://banes-lab.com/records/layer/causality-core.md",
    "ref": "layer:causality-core"
  },
  "name": "Vector Clocks",
  "ref": "architecture:vector-clocks",
  "relations": [
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology/lexicon#lexicon-node-identity",
          "json": "https://banes-lab.com/json/records/lexicon/node-identity",
          "label": "Node Identity",
          "markdown": "https://banes-lab.com/records/lexicon/node-identity.md",
          "ref": "lexicon:node-identity"
        },
        {
          "href": "https://banes-lab.com/ontology/lexicon#lexicon-version-vector",
          "json": "https://banes-lab.com/json/records/lexicon/version-vector",
          "label": "Version Vector",
          "markdown": "https://banes-lab.com/records/lexicon/version-vector.md",
          "ref": "lexicon:version-vector"
        }
      ],
      "relation": "requires"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology#architecture-causal-consistency",
          "json": "https://banes-lab.com/json/records/architecture/causal-consistency",
          "label": "Causal Consistency",
          "markdown": "https://banes-lab.com/records/architecture/causal-consistency.md",
          "ref": "architecture:causal-consistency"
        }
      ],
      "relation": "reinforces"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology/lexicon#lexicon-concurrent-update-detection",
          "json": "https://banes-lab.com/json/records/lexicon/concurrent-update-detection",
          "label": "Concurrent Update Detection",
          "markdown": "https://banes-lab.com/records/lexicon/concurrent-update-detection.md",
          "ref": "lexicon:concurrent-update-detection"
        }
      ],
      "relation": "enables"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology/lexicon#lexicon-single-global-clock-assumption",
          "json": "https://banes-lab.com/json/records/lexicon/single-global-clock-assumption",
          "label": "Single Global Clock Assumption",
          "markdown": "https://banes-lab.com/records/lexicon/single-global-clock-assumption.md",
          "ref": "lexicon:single-global-clock-assumption"
        }
      ],
      "relation": "conflicts-with"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology/lexicon#lexicon-metadata-size",
          "json": "https://banes-lab.com/json/records/lexicon/metadata-size",
          "label": "Metadata Size",
          "markdown": "https://banes-lab.com/records/lexicon/metadata-size.md",
          "ref": "lexicon:metadata-size"
        }
      ],
      "relation": "tensions-with"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology/schema#tension-metadata-size-vector-clocks",
          "json": "https://banes-lab.com/json/records/tension/metadata-size-vector-clocks",
          "label": "Vector Clocks / Metadata Size",
          "markdown": "https://banes-lab.com/records/tension/metadata-size-vector-clocks.md",
          "ref": "tension:metadata-size-vector-clocks"
        }
      ],
      "relation": "tensions"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology#architecture-lost-update",
          "json": "https://banes-lab.com/json/records/architecture/lost-update",
          "label": "Lost Update",
          "markdown": "https://banes-lab.com/records/architecture/lost-update.md",
          "ref": "architecture:lost-update"
        }
      ],
      "relation": "violated-by"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology/schema#vocabulary-severity-contextual",
          "json": "https://banes-lab.com/json/records/vocabulary/severity-contextual",
          "label": "contextual",
          "markdown": "https://banes-lab.com/records/vocabulary/severity-contextual.md",
          "ref": "vocabulary:severity-contextual"
        }
      ],
      "relation": "severity"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology#architecture-category-causality-ordering-distributed-time",
          "json": "https://banes-lab.com/json/records/architecture-category/causality-ordering-distributed-time",
          "label": "Causality / Ordering / Distributed Time",
          "markdown": "https://banes-lab.com/records/architecture-category/causality-ordering-distributed-time.md",
          "ref": "architecture-category:causality-ordering-distributed-time"
        }
      ],
      "relation": "category"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/software-architecture/principles#execution-joins-the-halves",
          "json": "https://banes-lab.com/json/software-architecture/principles/execution-joins-the-halves",
          "label": "Execution joins the halves",
          "markdown": "https://banes-lab.com/software-architecture/principles/execution-joins-the-halves.md",
          "ref": "chapter:/software-architecture/principles#execution-joins-the-halves"
        },
        {
          "href": "https://banes-lab.com/ontology#architecture-category-causality-ordering-distributed-time",
          "json": "https://banes-lab.com/json/ontology/principles/architecture-category-causality-ordering-distributed-time",
          "label": "Causality / Ordering / Distributed Time",
          "markdown": "https://banes-lab.com/ontology/principles/architecture-category-causality-ordering-distributed-time.md",
          "ref": "chapter:/ontology#architecture-category-causality-ordering-distributed-time"
        },
        {
          "href": "https://banes-lab.com/ontology/lexicon#lexicon-category-causality-ordering-distributed-time",
          "json": "https://banes-lab.com/json/ontology/lexicon/lexicon-category-causality-ordering-distributed-time",
          "label": "Causality / Ordering / Distributed Time",
          "markdown": "https://banes-lab.com/ontology/lexicon/lexicon-category-causality-ordering-distributed-time.md",
          "ref": "chapter:/ontology/lexicon#lexicon-category-causality-ordering-distributed-time"
        },
        {
          "href": "https://banes-lab.com/ontology/schema#the-vocabulary-severity",
          "json": "https://banes-lab.com/json/ontology/schema/the-vocabulary-severity",
          "label": "Severity levels",
          "markdown": "https://banes-lab.com/ontology/schema/the-vocabulary-severity.md",
          "ref": "chapter:/ontology/schema#the-vocabulary-severity"
        },
        {
          "href": "https://banes-lab.com/ontology/schema#the-resolutions",
          "json": "https://banes-lab.com/json/ontology/schema/the-resolutions",
          "label": "The resolutions",
          "markdown": "https://banes-lab.com/ontology/schema/the-resolutions.md",
          "ref": "chapter:/ontology/schema#the-resolutions"
        }
      ],
      "relation": "linked-from"
    }
  ],
  "summary": "A mechanism that keeps one counter per node on each update, so two updates can be compared as ordered or concurrent.",
  "siblings": {
    "next": {
      "href": "https://banes-lab.com/ontology#architecture-lamport-clocks",
      "json": "https://banes-lab.com/json/records/architecture/lamport-clocks",
      "label": "Lamport Clocks",
      "markdown": "https://banes-lab.com/records/architecture/lamport-clocks.md",
      "ref": "architecture:lamport-clocks"
    },
    "previous": {
      "href": "https://banes-lab.com/ontology#architecture-directed-acyclic-graph",
      "json": "https://banes-lab.com/json/records/architecture/directed-acyclic-graph",
      "label": "Directed Acyclic Graph (DAG)",
      "markdown": "https://banes-lab.com/records/architecture/directed-acyclic-graph.md",
      "ref": "architecture:directed-acyclic-graph"
    }
  },
  "up": {
    "href": null,
    "json": "https://banes-lab.com/json/api/records/architecture",
    "label": "Architecture principles",
    "markdown": "https://banes-lab.com/api/records/architecture.md",
    "ref": "api:records/architecture"
  },
  "aliases": [],
  "exemplar": {
    "after": "const relation = compareVectorClocks(a.clock, b.clock);\nif (relation === \"concurrent\") return mergeFoo(a, b);\nreturn relation === \"after\" ? a : b;",
    "before": "const winner = a.updatedAt > b.updatedAt ? a : b;",
    "lang": "ts",
    "medium": "code"
  },
  "formedBy": null,
  "scope": [
    "distributed events",
    "replication"
  ],
  "severity": "contextual"
}
