github.com/opentofu/opentofu@v1.7.1/internal/states/statemgr/doc.go (about) 1 // Copyright (c) The OpenTofu Authors 2 // SPDX-License-Identifier: MPL-2.0 3 // Copyright (c) 2023 HashiCorp, Inc. 4 // SPDX-License-Identifier: MPL-2.0 5 6 // Package statemgr defines the interfaces and some supporting functionality 7 // for "state managers", which are components responsible for writing state 8 // to some persistent storage and then later retrieving it. 9 // 10 // State managers will usually (but not necessarily) use the state file formats 11 // implemented in the sibling directory "statefile" to serialize the persistent 12 // parts of state for storage. 13 // 14 // State managers are responsible for ensuring that stored state can be updated 15 // safely across multiple, possibly-concurrent OpenTofu runs (with reasonable 16 // constraints and limitations). The rest of OpenTofu considers state to be 17 // a mutable data structure, with state managers preserving that illusion 18 // by creating snapshots of the state and updating them over time. 19 // 20 // From the perspective of callers of the general state manager API, a state 21 // manager is able to return the latest snapshot and to replace that snapshot 22 // with a new one. Some state managers may also preserve historical snapshots 23 // using facilities offered by their storage backend, but this is always an 24 // implementation detail: the historical versions are not visible to a user 25 // of these interfaces. 26 package statemgr