github.com/davebizus/terraform-main@v0.11.12-beta1/state/lock.go (about)

     1  package state
     2  
     3  import (
     4  	"github.com/hashicorp/terraform/terraform"
     5  )
     6  
     7  // LockDisabled implements State and Locker but disables state locking.
     8  // If State doesn't support locking, this is a no-op. This is useful for
     9  // easily disabling locking of an existing state or for tests.
    10  type LockDisabled struct {
    11  	// We can't embed State directly since Go dislikes that a field is
    12  	// State and State interface has a method State
    13  	Inner State
    14  }
    15  
    16  func (s *LockDisabled) State() *terraform.State {
    17  	return s.Inner.State()
    18  }
    19  
    20  func (s *LockDisabled) WriteState(v *terraform.State) error {
    21  	return s.Inner.WriteState(v)
    22  }
    23  
    24  func (s *LockDisabled) RefreshState() error {
    25  	return s.Inner.RefreshState()
    26  }
    27  
    28  func (s *LockDisabled) PersistState() error {
    29  	return s.Inner.PersistState()
    30  }
    31  
    32  func (s *LockDisabled) Lock(info *LockInfo) (string, error) {
    33  	return "", nil
    34  }
    35  
    36  func (s *LockDisabled) Unlock(id string) error {
    37  	return nil
    38  }