4 State management

Time travel

This chapter covers

  • A multi-version approach to state management
  • The calculation phase of a mutation
  • The commit phase of a mutation
  • Keeping a history of previous state versions

So far, we have seen how DOP handles queries via generic functions that access system data, which is represented as a hash map. In this chapter, we illustrate how DOP deals with mutations (requests that change the system state). Instead of updating the state in place, we maintain multiple versions of the system data. At a specific point in time, the system state refers to a specific version of the system data. This chapter is a deep dive in the third principle of DOP.

Principle #3 Data is immutable.

The maintenance of multiple versions ...

Get Data-Oriented Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.