opentofu/internal/states/statemgr/lock.go
Martin Atkins f40800b3a4 Move states/ to internal/states/
This is part of a general effort to move all of Terraform's non-library
package surface under internal in order to reinforce that these are for
internal use within Terraform only.

If you were previously importing packages under this prefix into an
external codebase, you could pin to an earlier release tag as an interim
solution until you've make a plan to achieve the same functionality some
other way.
2021-05-17 14:09:07 -07:00

37 lines
912 B
Go

package statemgr
import "github.com/hashicorp/terraform/internal/states"
// LockDisabled implements State and Locker but disables state locking.
// If State doesn't support locking, this is a no-op. This is useful for
// easily disabling locking of an existing state or for tests.
type LockDisabled struct {
// We can't embed State directly since Go dislikes that a field is
// State and State interface has a method State
Inner Full
}
func (s *LockDisabled) State() *states.State {
return s.Inner.State()
}
func (s *LockDisabled) WriteState(v *states.State) error {
return s.Inner.WriteState(v)
}
func (s *LockDisabled) RefreshState() error {
return s.Inner.RefreshState()
}
func (s *LockDisabled) PersistState() error {
return s.Inner.PersistState()
}
func (s *LockDisabled) Lock(info *LockInfo) (string, error) {
return "", nil
}
func (s *LockDisabled) Unlock(id string) error {
return nil
}