Documentation ¶
Index ¶
- Constants
- Variables
- func Server(impl BackendPlugin) *plugin.ServeConfig
- type BackendPlugin
- type GRPCClient
- func (c *GRPCClient) Configure(ctx context.Context, config map[string]string) error
- func (c *GRPCClient) DeleteState(ctx context.Context, workspace string) error
- func (c *GRPCClient) DeleteWorkspace(ctx context.Context, workspace string, force bool) error
- func (c *GRPCClient) GetStatePayload(ctx context.Context, workspace string) (*Payload, error)
- func (c *GRPCClient) ListWorkspaces(ctx context.Context) ([]string, error)
- func (c *GRPCClient) LockState(ctx context.Context, workspace string, info *LockInfo) (string, error)
- func (c *GRPCClient) PutState(ctx context.Context, workspace string, data []byte) error
- func (c *GRPCClient) UnlockState(ctx context.Context, workspace, id string) error
- type GRPCPlugin
- type GRPCServer
- func (s *GRPCServer) ConfigureBackend(ctx context.Context, req *proto.ConfigureBackend_Request) (*proto.Empty, error)
- func (s *GRPCServer) DeleteState(ctx context.Context, req *proto.DeleteState_Request) (*proto.Empty, error)
- func (s *GRPCServer) DeleteWorkspace(ctx context.Context, req *proto.DeleteWorkspace_Request) (*proto.Empty, error)
- func (s *GRPCServer) GetStatePayload(ctx context.Context, req *proto.GetStatePayload_Request) (*proto.GetStatePayload_Response, error)
- func (s *GRPCServer) ListWorkspaces(ctx context.Context, req *proto.ListWorkspaces_Request) (*proto.ListWorkspaces_Response, error)
- func (s *GRPCServer) LockState(ctx context.Context, req *proto.StateLock_Request) (*proto.StateLock_Response, error)
- func (s *GRPCServer) PutState(ctx context.Context, req *proto.PutState_Request) (*proto.Empty, error)
- func (s *GRPCServer) UnlockState(ctx context.Context, req *proto.StateUnlock_Request) (*proto.Empty, error)
- type LockInfo
- type Payload
Constants ¶
View Source
const BackendPluginName = "backend"
Variables ¶
View Source
var Handshake = plugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "BACKEND_PLUGIN",
MagicCookieValue: "i-solemnly-swear-i-am-up-to-no-good",
}
View Source
var Plugins = map[string]plugin.Plugin{ BackendPluginName: &GRPCPlugin{}, }
PluginMap is the map of plugins we can dispense.
Functions ¶
func Server ¶
func Server(impl BackendPlugin) *plugin.ServeConfig
Server creates a plugin.ServeConfig for the given BackendPlugin.
Types ¶
type BackendPlugin ¶
type BackendPlugin interface { // Configuration. Configure(_ context.Context, config map[string]string) error // Workspace operations. ListWorkspaces(_ context.Context) ([]string, error) DeleteWorkspace(_ context.Context, workspace string, force bool) error // State operations. GetStatePayload(_ context.Context, workspace string) (*Payload, error) PutState(_ context.Context, workspace string, data []byte) error DeleteState(_ context.Context, workspace string) error LockState(_ context.Context, workspace string, info *LockInfo) (string, error) UnlockState(_ context.Context, workspace, id string) error }
type GRPCClient ¶
type GRPCClient struct {
// contains filtered or unexported fields
}
func (*GRPCClient) DeleteState ¶
func (c *GRPCClient) DeleteState(ctx context.Context, workspace string) error
func (*GRPCClient) DeleteWorkspace ¶
func (*GRPCClient) GetStatePayload ¶
func (*GRPCClient) ListWorkspaces ¶
func (c *GRPCClient) ListWorkspaces(ctx context.Context) ([]string, error)
func (*GRPCClient) UnlockState ¶
func (c *GRPCClient) UnlockState(ctx context.Context, workspace, id string) error
type GRPCPlugin ¶
type GRPCPlugin struct { // GRPCPlugin must still implement the Plugin interface plugin.Plugin // Concrete implementation, written in Go. Impl BackendPlugin // contains filtered or unexported fields }
func (*GRPCPlugin) GRPCClient ¶
func (p *GRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
func (*GRPCPlugin) GRPCServer ¶
func (p *GRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error
type GRPCServer ¶
type GRPCServer struct { proto.UnimplementedBackendServer // This is the real implementation Impl BackendPlugin // contains filtered or unexported fields }
func (*GRPCServer) ConfigureBackend ¶
func (s *GRPCServer) ConfigureBackend(ctx context.Context, req *proto.ConfigureBackend_Request) (*proto.Empty, error)
func (*GRPCServer) DeleteState ¶
func (s *GRPCServer) DeleteState(ctx context.Context, req *proto.DeleteState_Request) (*proto.Empty, error)
func (*GRPCServer) DeleteWorkspace ¶
func (s *GRPCServer) DeleteWorkspace(ctx context.Context, req *proto.DeleteWorkspace_Request) (*proto.Empty, error)
func (*GRPCServer) GetStatePayload ¶
func (s *GRPCServer) GetStatePayload(ctx context.Context, req *proto.GetStatePayload_Request) (*proto.GetStatePayload_Response, error)
func (*GRPCServer) ListWorkspaces ¶
func (s *GRPCServer) ListWorkspaces(ctx context.Context, req *proto.ListWorkspaces_Request) (*proto.ListWorkspaces_Response, error)
func (*GRPCServer) LockState ¶
func (s *GRPCServer) LockState(ctx context.Context, req *proto.StateLock_Request) (*proto.StateLock_Response, error)
func (*GRPCServer) PutState ¶
func (s *GRPCServer) PutState(ctx context.Context, req *proto.PutState_Request) (*proto.Empty, error)
func (*GRPCServer) UnlockState ¶
func (s *GRPCServer) UnlockState(ctx context.Context, req *proto.StateUnlock_Request) (*proto.Empty, error)
type LockInfo ¶
type LockInfo struct { // Unique ID for the lock. NewLockInfo provides a random ID, but this may // be overridden by the lock implementation. The final value of ID will be // returned by the call to Lock. ID string // Terraform operation, provided by the caller. Operation string // Extra information to store with the lock, provided by the caller. Info string // user@hostname when available Who string // Terraform version Version string // Time that the lock was taken. Created time.Time // Path to the state file when applicable. Set by the Lock implementation. Path string }
LockInfo is the information that is stored with a lock.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.