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