plugins

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

plugin package contains interfaces for storage plugins.

Index

Constants

View Source
const (
	// PluginInterface for storage. This first part of the
	// three-part plugin key is only seen/used by the plugins when the host is
	// communicating with the plugin and is not exposed to users.
	PluginInterface = "storage"

	// PluginProtocolVersion is the currently supported plugin protocol version for storage.
	PluginProtocolVersion = 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregateOptions

type AggregateOptions struct {
	// Collection to query.
	Collection string

	// Pipeline document to aggregate, filter, and shape the results.
	// See https://docs.mongodb.com/manual/reference/operator/aggregation-pipeline/
	Pipeline []bson.D
}

AggregateOptions is the set of options available to the StorageProtocol.Aggregate operation.

type CountOptions

type CountOptions struct {
	// Collection to query.
	Collection string

	// Query is a query filter document
	// See https://docs.mongodb.com/manual/core/document/#std-label-document-query-filter
	Filter bson.M
}

CountOptions is the set of options available to the StorageProtocol.Count operation.

type EnsureIndexOptions

type EnsureIndexOptions struct {
	// Indices to create if not found.
	Indices []Index
}

EnsureIndexOptions is the set of options available to the StorageProtocol.EnsureIndex operation.

type FindOptions

type FindOptions struct {
	// Collection to query.
	Collection string

	// Sort is a list of field names by which the results should be sorted.
	Sort bson.D

	// Skip is the number of results to skip past and exclude from the results.
	Skip int64

	// Limit is the number of results to return.
	Limit int64

	// Select is a projection document
	// See https://docs.mongodb.com/manual/tutorial/project-fields-from-query-results/
	Select bson.D

	// Filter specifies how to filter the results.
	// See https://docs.mongodb.com/manual/core/document/#std-label-document-query-filter
	Filter bson.M
}

FindOptions is the set of options available to the StorageProtocol.Find operation.

type Index

type Index struct {
	// Collection name to which the index applies.
	Collection string

	// Keys describes the fields and their sort order.
	// Example: {"namespace": 1, "name": 1}
	Keys bson.D

	// Unique specifies if the index should enforce that the indexed fields for each document are unique.
	Unique bool
}

Index on a collection.

type InsertOptions

type InsertOptions struct {
	// Collection to query.
	Collection string

	// Documents is a set of documents to insert.
	Documents []bson.M
}

InsertOptions is the set of options for the StorageProtocol.Insert operation.

type PatchOptions

type PatchOptions struct {
	// Collection to query.
	Collection string

	// Query is a query filter document
	// See https://docs.mongodb.com/manual/core/document/#std-label-document-query-filter
	QueryDocument bson.M

	// Transformation is set of instructions to modify matching
	// documents.
	Transformation bson.D
}

PatchOptions is the set of options for the StorageProtocol.Patch operation.

type RemoveOptions

type RemoveOptions struct {
	// Collection to query.
	Collection string

	// Filter is a query filter document
	// See https://docs.mongodb.com/manual/core/document/#std-label-document-query-filter
	Filter bson.M

	// All matching documents should be removed. Defaults to false, which only
	// removes the first matching document.
	All bool
}

RemoveOptions is the set of options for the StorageProtocol.Remove operation.

type StorageProtocol

type StorageProtocol interface {
	// EnsureIndex makes sure that the specified index exists as specified.
	// If it does exist with a different definition, the index is recreated.
	EnsureIndex(ctx context.Context, opts EnsureIndexOptions) error

	// Aggregate executes a pipeline and returns the results.
	Aggregate(ctx context.Context, opts AggregateOptions) ([]bson.Raw, error)

	// Count the number of results that match an optional query.
	// When the query is omitted, the entire collection is counted.
	Count(ctx context.Context, opts CountOptions) (int64, error)

	// Find queries a collection, optionally projecting a subset of fields, and
	// then returns the results as a list of bson documents.
	Find(ctx context.Context, opts FindOptions) ([]bson.Raw, error)

	// Insert a set of documents into a collection.
	Insert(ctx context.Context, opts InsertOptions) error

	// Patch applies a transformation to matching documents.
	Patch(ctx context.Context, opts PatchOptions) error

	// Remove matching documents from a collection.
	Remove(ctx context.Context, opts RemoveOptions) error

	// Update matching documents with the specified replacement document.
	Update(ctx context.Context, opts UpdateOptions) error
}

StorageProtocol is the interface that storage plugins must implement. This defines the protocol used to communicate with storage plugins.

type UpdateOptions

type UpdateOptions struct {
	// Collection to query.
	Collection string

	// Filter is a query filter document
	// See https://docs.mongodb.com/manual/core/document/#std-label-document-query-filter
	Filter bson.M

	// Upsert indicates that the document should be inserted if not found
	Upsert bool

	// Document is the replacement document.
	Document bson.M
}

UpdateOptions is the set of options for the StorageProtocol.Update operation.

Directories

Path Synopsis
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.
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.
Package proto is the protobuf definition for the StorageProtocol
Package proto is the protobuf definition for the StorageProtocol

Jump to

Keyboard shortcuts

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