pluginstore

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: 14 Imported by: 0

Documentation

Overview

Package pluginstore is an internal Porter package that implements the plugins.StorageProtocol interface via the hashicorp/go-plugins library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsMap added in v1.0.1

func AsMap(src *structpb.Struct, c ...converter) bson.M

AsMap converts a protobuf struct into its original representation, bson.M.

func AsMapList added in v1.0.1

func AsMapList(src []*structpb.Struct) []bson.M

func AsOrderedMap added in v1.0.1

func AsOrderedMap(src []*structpb.Struct, c ...converter) bson.D

AsOrderedMap converts an array of protobuf structs into its original representation, bson.D.

func AsOrderedMapList added in v1.0.1

func AsOrderedMapList(src []*proto.Stage) []bson.D

AsOrderedMapList converts a protobuf Pipeline into its original representation, []bson.D

func ConvertBsonToPrimitives added in v1.0.1

func ConvertBsonToPrimitives(src interface{}) interface{}

ConvertBsonToPrimitives converts from bson primitives to pure Go primitives

func ConvertFloatToInt added in v1.0.1

func ConvertFloatToInt(src interface{}) interface{}

ConvertFloatToInt works around a weirdness in how numbers are represented by structpb.Value, where integer values are stored in float64. When we deserialize from protobuf, this walks the specified value, finds ints that were encoded as floats, and converts them back to ints.

func ConvertSliceToBsonD added in v1.0.1

func ConvertSliceToBsonD(src interface{}) interface{}

ConvertSliceToBsonD converts go slices to bson primitive. it also works around a weirdness in how numbers are represented by structpb.Value, where integer values are stored in float64. When we deserialize from protobuf, this walks the specified value, finds ints that were encoded as floats, and converts them back to ints.

func FromMap added in v1.0.1

func FromMap(src bson.M) *structpb.Struct

FromMap represents bson.M in a data structure that protobuf understands (which is a plain struct).

func FromMapList added in v1.0.1

func FromMapList(src []bson.M) []*structpb.Struct

FromMapList represents []bson.M in a data structure that protobuf understands (an array of structs).

func FromOrderedMap added in v1.0.1

func FromOrderedMap(src bson.D) []*structpb.Struct

FromOrderedMap represents bson.D, an ordered map, in a data structure that protobuf understands (an array of structs).

func NewPipeline added in v1.0.1

func NewPipeline(src []bson.D) []*proto.Stage

func NewStoragePluginConfig

func NewStoragePluginConfig() pluggable.PluginTypeConfig

NewStoragePluginConfig for porter home storage.

func NewStruct added in v1.0.1

func NewStruct(src map[string]interface{}) *structpb.Struct

Types

type GClient added in v1.0.1

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

GClient is a gRPC implementation of the storage client.

func NewClient added in v1.0.1

func NewClient(client proto.StorageProtocolClient) *GClient

func (*GClient) Aggregate added in v1.0.1

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

func (*GClient) Count added in v1.0.1

func (m *GClient) Count(ctx context.Context, opts plugins.CountOptions) (int64, error)

func (*GClient) EnsureIndex added in v1.0.1

func (m *GClient) EnsureIndex(ctx context.Context, opts plugins.EnsureIndexOptions) error

func (*GClient) Find added in v1.0.1

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

func (*GClient) Insert added in v1.0.1

func (m *GClient) Insert(ctx context.Context, opts plugins.InsertOptions) error

func (*GClient) Patch added in v1.0.1

func (m *GClient) Patch(ctx context.Context, opts plugins.PatchOptions) error

func (*GClient) Remove added in v1.0.1

func (m *GClient) Remove(ctx context.Context, opts plugins.RemoveOptions) error

func (*GClient) Update added in v1.0.1

func (m *GClient) Update(ctx context.Context, opts plugins.UpdateOptions) error

type GServer added in v1.0.1

type GServer struct {
	proto.UnsafeStorageProtocolServer
	// contains filtered or unexported fields
}

GServer is a gRPC wrapper around a StorageProtocol plugin

func NewServer added in v1.0.1

func (*GServer) Aggregate added in v1.0.1

func (m *GServer) Aggregate(ctx context.Context, request *proto.AggregateRequest) (*proto.AggregateResponse, error)

func (*GServer) Count added in v1.0.1

func (*GServer) EnsureIndex added in v1.0.1

func (m *GServer) EnsureIndex(ctx context.Context, request *proto.EnsureIndexRequest) (*proto.EnsureIndexResponse, error)

func (*GServer) Find added in v1.0.1

func (m *GServer) Find(ctx context.Context, request *proto.FindRequest) (*proto.FindResponse, error)

func (*GServer) Insert added in v1.0.1

func (m *GServer) Insert(ctx context.Context, request *proto.InsertRequest) (*proto.InsertResponse, error)

func (*GServer) Patch added in v1.0.1

func (m *GServer) Patch(ctx context.Context, request *proto.PatchRequest) (*proto.PatchResponse, error)

func (*GServer) Remove added in v1.0.1

func (m *GServer) Remove(ctx context.Context, request *proto.RemoveRequest) (*proto.RemoveResponse, error)

func (*GServer) Update added in v1.0.1

func (m *GServer) Update(ctx context.Context, request *proto.UpdateRequest) (*proto.UpdateResponse, error)

type Plugin added in v1.0.1

type Plugin struct {
	plugin.Plugin
	// contains filtered or unexported fields
}

Plugin is the shared implementation of a storage plugin wrapper.

func NewPlugin added in v1.0.1

NewPlugin creates an instance of a storage plugin.

func (Plugin) GRPCClient added in v1.0.1

func (p Plugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, conn *grpc.ClientConn) (interface{}, error)

func (Plugin) GRPCServer added in v1.0.1

func (p Plugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error

type Store

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

Store is a plugin-backed source of storage. It resolves the appropriate plugin based on Porter's config and implements the plugins.StorageProtocol interface using the backing plugin.

Connects just-in-time, but you must call Close to release resources.

func NewStore

func NewStore(c *config.Config) *Store

func (*Store) Aggregate added in v1.0.1

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 added in v1.0.1

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

func (*Store) EnsureIndex added in v1.0.1

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

func (*Store) Find added in v1.0.1

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

func (*Store) Insert added in v1.0.1

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

func (*Store) Patch added in v1.0.1

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

func (*Store) Remove added in v1.0.1

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

func (*Store) Update added in v1.0.1

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