github.com/opentofu/opentofu@v1.7.1/internal/states/remote/remote.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 remote 7 8 import ( 9 "github.com/opentofu/opentofu/internal/states/statemgr" 10 ) 11 12 // Client is the interface that must be implemented for a remote state 13 // driver. It supports dumb put/get/delete, and the higher level structs 14 // handle persisting the state properly here. 15 type Client interface { 16 Get() (*Payload, error) 17 Put([]byte) error 18 Delete() error 19 } 20 21 // ClientForcePusher is an optional interface that allows a remote 22 // state to force push by managing a flag on the client that is 23 // toggled on by a call to EnableForcePush. 24 type ClientForcePusher interface { 25 Client 26 EnableForcePush() 27 } 28 29 // ClientLocker is an optional interface that allows a remote state 30 // backend to enable state lock/unlock. 31 type ClientLocker interface { 32 Client 33 statemgr.Locker 34 } 35 36 // Payload is the return value from the remote state storage. 37 type Payload struct { 38 MD5 []byte 39 Data []byte 40 } 41 42 // Factory is the factory function to create a remote client. 43 type Factory func(map[string]string) (Client, error)