mongodb_docker

package
v1.0.17 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package mongodb_docker implements the plugins.StorageProtocol interface, storing data using an instance of mongodb running in a container, with the data stored in a docker volume.

Index

Constants

View Source
const PluginKey = plugins.PluginInterface + ".porter.mongodb-docker"

PluginKey is the identifier of the internal mongodb run in docker plugin.

Variables

This section is empty.

Functions

func EnsureMongoIsRunning

func EnsureMongoIsRunning(ctx context.Context, c *portercontext.Context, container string, port string, dataVol string, dbName string, timeoutSeconds int) (*mongodb.Store, error)

func NewPlugin

func NewPlugin(c *portercontext.Context, rawCfg interface{}) (plugin.Plugin, error)

NewPlugin creates an instance of the storage.porter.mongodb-docker plugin

Types

type PluginConfig

type PluginConfig struct {
	Port     string `mapstructure:"port,omitempty"`
	Database string `mapstructure:"database,omitempty"`

	// Timeout in seconds
	Timeout int `mapstructure:"timeout,omitempty"`
}

PluginConfig supported by the mongodb-docker plugin as defined in porter.yaml

type Store

type Store struct {
	*mongodb.Store
	// contains filtered or unexported fields
}

Store is a storage plugin for porter suitable for running on machines that have not configured proper storage, i.e. a mongo database. It runs mongodb in a docker container and stores its data in a docker volume.

func NewStore

func NewStore(c *portercontext.Context, cfg PluginConfig) *Store

func (*Store) Aggregate

func (s *Store) Aggregate(ctx context.Context, opts plugins.AggregateOptions) ([]bson.Raw, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) Connect

func (s *Store) Connect(ctx context.Context) error

Connect initializes the plugin for use. The plugin itself is responsible for ensuring it was called. Close is called automatically when the plugin is used by Porter.

func (*Store) Count

func (s *Store) Count(ctx context.Context, opts plugins.CountOptions) (int64, error)

func (*Store) EnsureIndex

func (s *Store) EnsureIndex(ctx context.Context, opts plugins.EnsureIndexOptions) error

EnsureIndex makes sure that the specified index exists as specified. If it does exist with a different definition, the index is recreated.

func (*Store) Find

func (s *Store) Find(ctx context.Context, opts plugins.FindOptions) ([]bson.Raw, error)

func (*Store) Insert

func (s *Store) Insert(ctx context.Context, opts plugins.InsertOptions) error

func (*Store) Patch

func (s *Store) Patch(ctx context.Context, opts plugins.PatchOptions) error

func (*Store) Remove

func (s *Store) Remove(ctx context.Context, opts plugins.RemoveOptions) error

func (*Store) Update

func (s *Store) Update(ctx context.Context, opts plugins.UpdateOptions) error

Jump to

Keyboard shortcuts

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