mongodb

package
v3.65.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: MIT Imports: 31 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCache

func NewCache(
	conf cache.Config, mgr types.Manager, log log.Modular, stats metrics.Type,
) (types.Cache, error)

NewCache returns a MongoDB cache.

func NewOutput

func NewOutput(conf output.MongoDBConfig, mgr bundle.NewManagement, log log.Modular, stats metrics.Type) (output.Type, error)

NewOutput creates a new MongoDB output type.

func NewProcessor

func NewProcessor(
	conf processor.Config, mgr bundle.NewManagement, log log.Modular, stats metrics.Type,
) (types.Processor, error)

NewProcessor returns a MongoDB processor.

Types

type Cache

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

Cache is a cache that connects to mongo databases.

func (*Cache) Add

func (m *Cache) Add(key string, value []byte) error

Add attempts to set the value of a key only if the key does not already exist and returns an error if the key already exists or if the operation fails.

func (*Cache) CloseAsync

func (m *Cache) CloseAsync()

CloseAsync shuts down the cache.

func (*Cache) Delete

func (m *Cache) Delete(key string) error

Delete attempts to remove a key.

func (*Cache) Get

func (m *Cache) Get(key string) ([]byte, error)

Get attempts to locate and return a cached value by its key, returns an error if the key does not exist or if the operation failed.

func (*Cache) Set

func (m *Cache) Set(key string, value []byte) error

Set attempts to set the value of a key.

func (*Cache) SetMulti

func (m *Cache) SetMulti(items map[string][]byte) error

SetMulti attempts to set the value of multiple keys, returns an error if any keys fail.

func (*Cache) WaitForClose

func (m *Cache) WaitForClose(timeout time.Duration) error

WaitForClose blocks until the cache has closed down.

type Processor

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

Processor stores or retrieves data from a mongo db for each message of a batch

func (*Processor) CloseAsync

func (m *Processor) CloseAsync()

CloseAsync shuts down the processor and stops processing requests.

func (*Processor) ProcessMessage

func (m *Processor) ProcessMessage(msg types.Message) ([]types.Message, types.Response)

ProcessMessage applies the processor to a message, either creating >0 resulting messages or a response to be sent back to the message source.

func (*Processor) WaitForClose

func (m *Processor) WaitForClose(timeout time.Duration) error

WaitForClose blocks until the processor has closed down.

type Writer

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

Writer is a benthos writer.Type implementation that writes messages to an Writer database.

func NewWriter

func NewWriter(
	mgr bundle.NewManagement,
	conf output.MongoDBConfig,
	log log.Modular,
	stats metrics.Type,
) (*Writer, error)

NewWriter creates a new MongoDB writer.Type.

func (*Writer) CloseAsync

func (m *Writer) CloseAsync()

CloseAsync begins cleaning up resources used by this writer asynchronously.

func (*Writer) ConnectWithContext

func (m *Writer) ConnectWithContext(ctx context.Context) error

ConnectWithContext attempts to establish a connection to the target mongo DB

func (*Writer) WaitForClose

func (m *Writer) WaitForClose(timeout time.Duration) error

WaitForClose will block until either the writer is closed or a specified timeout occurs.

func (*Writer) WriteWithContext

func (m *Writer) WriteWithContext(ctx context.Context, msg types.Message) error

WriteWithContext attempts to perform the designated operation to the mongo DB collection.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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