Documentation ¶
Overview ¶
Package pluginstore is an internal Porter package that implements the plugins.StorageProtocol interface via the hashicorp/go-plugins library.
Index ¶
- func AsMap(src *structpb.Struct, c ...converter) bson.M
- func AsMapList(src []*structpb.Struct) []bson.M
- func AsOrderedMap(src []*structpb.Struct, c ...converter) bson.D
- func AsOrderedMapList(src []*proto.Stage) []bson.D
- func ConvertBsonToPrimitives(src interface{}) interface{}
- func ConvertFloatToInt(src interface{}) interface{}
- func ConvertSliceToBsonD(src interface{}) interface{}
- func FromMap(src bson.M) *structpb.Struct
- func FromMapList(src []bson.M) []*structpb.Struct
- func FromOrderedMap(src bson.D) []*structpb.Struct
- func NewPipeline(src []bson.D) []*proto.Stage
- func NewStoragePluginConfig() pluggable.PluginTypeConfig
- func NewStruct(src map[string]interface{}) *structpb.Struct
- type GClient
- func (m *GClient) Aggregate(ctx context.Context, opts plugins.AggregateOptions) ([]bson.Raw, error)
- func (m *GClient) Count(ctx context.Context, opts plugins.CountOptions) (int64, error)
- func (m *GClient) EnsureIndex(ctx context.Context, opts plugins.EnsureIndexOptions) error
- func (m *GClient) Find(ctx context.Context, opts plugins.FindOptions) ([]bson.Raw, error)
- func (m *GClient) Insert(ctx context.Context, opts plugins.InsertOptions) error
- func (m *GClient) Patch(ctx context.Context, opts plugins.PatchOptions) error
- func (m *GClient) Remove(ctx context.Context, opts plugins.RemoveOptions) error
- func (m *GClient) Update(ctx context.Context, opts plugins.UpdateOptions) error
- type GServer
- func (m *GServer) Aggregate(ctx context.Context, request *proto.AggregateRequest) (*proto.AggregateResponse, error)
- func (m *GServer) Count(ctx context.Context, req *proto.CountRequest) (*proto.CountResponse, error)
- func (m *GServer) EnsureIndex(ctx context.Context, request *proto.EnsureIndexRequest) (*proto.EnsureIndexResponse, error)
- func (m *GServer) Find(ctx context.Context, request *proto.FindRequest) (*proto.FindResponse, error)
- func (m *GServer) Insert(ctx context.Context, request *proto.InsertRequest) (*proto.InsertResponse, error)
- func (m *GServer) Patch(ctx context.Context, request *proto.PatchRequest) (*proto.PatchResponse, error)
- func (m *GServer) Remove(ctx context.Context, request *proto.RemoveRequest) (*proto.RemoveResponse, error)
- func (m *GServer) Update(ctx context.Context, request *proto.UpdateRequest) (*proto.UpdateResponse, error)
- type Plugin
- type Store
- func (s *Store) Aggregate(ctx context.Context, opts plugins.AggregateOptions) ([]bson.Raw, error)
- func (s *Store) Close() error
- func (s *Store) Connect(ctx context.Context) error
- func (s *Store) Count(ctx context.Context, opts plugins.CountOptions) (int64, error)
- func (s *Store) EnsureIndex(ctx context.Context, opts plugins.EnsureIndexOptions) error
- func (s *Store) Find(ctx context.Context, opts plugins.FindOptions) ([]bson.Raw, error)
- func (s *Store) Insert(ctx context.Context, opts plugins.InsertOptions) error
- func (s *Store) Patch(ctx context.Context, opts plugins.PatchOptions) error
- func (s *Store) Remove(ctx context.Context, opts plugins.RemoveOptions) error
- func (s *Store) Update(ctx context.Context, opts plugins.UpdateOptions) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsMap ¶ added in v1.0.1
AsMap converts a protobuf struct into its original representation, bson.M.
func AsOrderedMap ¶ added in v1.0.1
AsOrderedMap converts an array of protobuf structs into its original representation, bson.D.
func AsOrderedMapList ¶ added in v1.0.1
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
FromMap represents bson.M in a data structure that protobuf understands (which is a plain struct).
func FromMapList ¶ added in v1.0.1
FromMapList represents []bson.M in a data structure that protobuf understands (an array of structs).
func FromOrderedMap ¶ added in v1.0.1
FromOrderedMap represents bson.D, an ordered map, in a data structure that protobuf understands (an array of structs).
func NewStoragePluginConfig ¶
func NewStoragePluginConfig() pluggable.PluginTypeConfig
NewStoragePluginConfig for porter home storage.
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) EnsureIndex ¶ added in v1.0.1
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 NewServer(c *portercontext.Context, impl plugins.StorageProtocol) *GServer
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 (m *GServer) Count(ctx context.Context, req *proto.CountRequest) (*proto.CountResponse, error)
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
func NewPlugin(c *portercontext.Context, impl plugins.StorageProtocol) Plugin
NewPlugin creates an instance of a storage plugin.
func (Plugin) GRPCClient ¶ added in v1.0.1
type Store ¶
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 (*Store) Connect ¶
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.