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
- Variables
- type GRPCClient
- func (c *GRPCClient) GetFolders(storageID string, limit int, from string) ([]string, error)
- func (c *GRPCClient) GetModificationTime(storageID, objectPath string) (int64, error)
- func (c *GRPCClient) GetModificationTimes(storageID, objectPath string) (map[string]int64, error)
- func (c *GRPCClient) RemoveMetadata(storageID, objectPath string) error
- func (c *GRPCClient) SetModificationTime(storageID, objectPath string, mTime int64) error
- type GRPCServer
- func (s *GRPCServer) GetFolders(ctx context.Context, req *proto.GetFoldersRequest) (*proto.GetFoldersResponse, error)
- func (s *GRPCServer) GetModificationTime(ctx context.Context, req *proto.GetModificationTimeRequest) (*proto.GetModificationTimeResponse, error)
- func (s *GRPCServer) GetModificationTimes(ctx context.Context, req *proto.GetModificationTimesRequest) (*proto.GetModificationTimesResponse, error)
- func (s *GRPCServer) RemoveMetadata(ctx context.Context, req *proto.RemoveMetadataRequest) (*emptypb.Empty, error)
- func (s *GRPCServer) SetModificationTime(ctx context.Context, req *proto.SetModificationTimeRequest) (*emptypb.Empty, error)
- type Metadater
- type Plugin
Constants ¶
const (
// PluginName defines the name for a metadata plugin
PluginName = "metadata"
)
Variables ¶
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 ¶
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 ¶
func (s *GRPCServer) GetFolders(ctx context.Context, req *proto.GetFoldersRequest) (*proto.GetFoldersResponse, error)
GetFolders implements the server side get folders method
func (*GRPCServer) GetModificationTime ¶
func (s *GRPCServer) GetModificationTime(ctx context.Context, req *proto.GetModificationTimeRequest) ( *proto.GetModificationTimeResponse, error, )
GetModificationTime implements the server side get modification time method
func (*GRPCServer) GetModificationTimes ¶
func (s *GRPCServer) GetModificationTimes(ctx context.Context, req *proto.GetModificationTimesRequest) ( *proto.GetModificationTimesResponse, error, )
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 ¶
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 ¶
GRPCServer defines the GRPC server implementation for this plugin