metadata

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package metadata defines the interface and the GRPC implementation for metadata plugins. Metadata plugins allow to support metadata, such as modification times, for cloud storage backends

Index

Constants

View Source
const (
	// PluginName defines the name for a metadata plugin
	PluginName = "metadata"
)

Variables

View Source
var (
	// Handshake is a common handshake that is shared by plugin and host.
	Handshake = plugin.HandshakeConfig{
		ProtocolVersion:  1,
		MagicCookieKey:   "SFTPGO_PLUGIN_METADATA",
		MagicCookieValue: "85dddeea-56d8-4d5b-b488-8b125edb3a0f",
	}
	// ErrNoSuchObject is the error that plugins must return if the request object does not exist
	ErrNoSuchObject = errors.New("no such object")
	// PluginMap is the map of plugins we can dispense.
	PluginMap = map[string]plugin.Plugin{
		PluginName: &Plugin{},
	}
)

Functions

This section is empty.

Types

type GRPCClient

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

GRPCClient is an implementation of Metadater interface that talks over RPC.

func (*GRPCClient) GetFolders

func (c *GRPCClient) GetFolders(storageID string, limit int, from string) ([]string, error)

GetFolders implements the Metadater interface

func (*GRPCClient) GetModificationTime

func (c *GRPCClient) GetModificationTime(storageID, objectPath string) (int64, error)

GetModificationTime implements the Metadater interface

func (*GRPCClient) GetModificationTimes

func (c *GRPCClient) GetModificationTimes(storageID, objectPath string) (map[string]int64, error)

GetModificationTimes implements the Metadater interface

func (*GRPCClient) RemoveMetadata

func (c *GRPCClient) RemoveMetadata(storageID, objectPath string) error

RemoveMetadata implements the Metadater interface

func (*GRPCClient) SetModificationTime

func (c *GRPCClient) SetModificationTime(storageID, objectPath string, mTime int64) error

SetModificationTime implements the Metadater interface

type GRPCServer

type GRPCServer struct {
	Impl Metadater
}

GRPCServer defines the gRPC server that GRPCClient talks to.

func (*GRPCServer) GetFolders

GetFolders implements the server side get folders method

func (*GRPCServer) GetModificationTime

GetModificationTime implements the server side get modification time method

func (*GRPCServer) GetModificationTimes

GetModificationTimes implements the server side get modification times method

func (*GRPCServer) RemoveMetadata

func (s *GRPCServer) RemoveMetadata(ctx context.Context, req *proto.RemoveMetadataRequest) (*emptypb.Empty, error)

RemoveMetadata implements the server side remove metadata method

func (*GRPCServer) SetModificationTime

func (s *GRPCServer) SetModificationTime(ctx context.Context, req *proto.SetModificationTimeRequest) (*emptypb.Empty, error)

SetModificationTime implements the server side set modification time method

type Metadater

type Metadater interface {
	SetModificationTime(storageID, objectPath string, mTime int64) error
	GetModificationTime(storageID, objectPath string) (int64, error)
	GetModificationTimes(storageID, objectPath string) (map[string]int64, error)
	RemoveMetadata(storageID, objectPath string) error
	GetFolders(storageID string, limit int, from string) ([]string, error)
}

Metadater defines the interface for metadata plugins

type Plugin

type Plugin struct {
	plugin.Plugin
	Impl Metadater
}

Plugin defines the implementation to serve/connect to a metadata plugin

func (*Plugin) GRPCClient

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

GRPCClient defines the GRPC client implementation for this plugin

func (*Plugin) GRPCServer

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

GRPCServer defines the GRPC server implementation for this plugin

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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