mongodb

package
v0.0.0-...-ad22a97 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2019 License: MIT Imports: 7 Imported by: 1

README

MongoDB Store

Documentation

Documentation

Index

Constants

View Source
const (
	DefaultLockCollectionName  = "terraform_locks"
	DefaultStateCollectionName = "terraform_states"
	DefaultConnectTimeout      = 60
	DefaultQueryTimeout        = 5
)

Defaults

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	LockCollectionName  string
	StateCollectionName string
	Database            string
	URI                 string
	ConnectTimeout      int
	QueryTimeout        int
}

Options MongoDB backend options

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store MongoDB store

func NewStore

func NewStore(opts *Options) *Store

NewStore creates a new MongoDB backend

func (*Store) DeleteLock

func (c *Store) DeleteLock(ref string) error

DeleteLock deletes a lock

func (*Store) DeleteState

func (c *Store) DeleteState(ref string) error

DeleteState deletes a state

func (*Store) GetLock

func (c *Store) GetLock(ref string) (*types.Lock, error)

GetLock gets the lock

func (*Store) GetState

func (c *Store) GetState(ref string) (map[string]interface{}, bool, error)

GetState gets the state

func (*Store) Init

func (c *Store) Init() error

Init initializes the backend

func (*Store) PutLock

func (c *Store) PutLock(ref string, lock types.Lock) error

PutLock puts the lock

func (*Store) PutState

func (c *Store) PutState(ref string, state, metadata map[string]interface{}, encrypted bool) error

PutState puts the state

func (*Store) WithClient

func (c *Store) WithClient(client *mongo.Client) *Store

WithClient allows an already connected client to be used

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL