s3

package
v2.0.0-rc2+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2019 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

Package s3 provides an endpoint for connecting to Amazon S3 or an S3-compatible storage

Index

Constants

This section is empty.

Variables

View Source
var (
	UserAgentAppName = "pydio.sync.client.s3"
	UserAgentVersion = "1.0"
)

Functions

This section is empty.

Types

type Client

type Client struct {
	Mc                          MockableMinio
	Bucket                      string
	RootPath                    string
	Host                        string
	ServerRequiresNormalization bool
	// contains filtered or unexported fields
}

Client wraps a Minio Client to speak with an S3-compatible backend

func NewClient

func NewClient(ctx context.Context, host string, key string, secret string, bucket string, rootPath string, secure bool, options model.EndpointOptions) (*Client, error)

func (*Client) ComputeChecksum

func (c *Client) ComputeChecksum(node *tree.Node) error

func (*Client) CreateNode

func (c *Client) CreateNode(ctx context.Context, node *tree.Node, updateIfExists bool) (err error)

func (*Client) DeleteNode

func (c *Client) DeleteNode(ctx context.Context, path string) (err error)

func (*Client) GetEndpointInfo

func (c *Client) GetEndpointInfo() model.EndpointInfo

func (*Client) GetReaderOn

func (c *Client) GetReaderOn(path string) (out io.ReadCloser, err error)

func (*Client) GetWriterOn

func (c *Client) GetWriterOn(cancel context.Context, path string, targetSize int64) (out io.WriteCloser, writeDone chan bool, writeErr chan error, err error)

func (*Client) LoadNode

func (c *Client) LoadNode(ctx context.Context, path string, extendedStats ...bool) (node *tree.Node, err error)

func (*Client) MoveNode

func (c *Client) MoveNode(ctx context.Context, oldPath string, newPath string) (err error)

func (*Client) SetPlainSizeComputer

func (c *Client) SetPlainSizeComputer(computer func(nodeUUID string) (int64, error))

func (*Client) Stat

func (c *Client) Stat(path string) (i os.FileInfo, err error)

func (*Client) UpdateNodeUuid

func (c *Client) UpdateNodeUuid(ctx context.Context, node *tree.Node) (*tree.Node, error)

UpdateNodeUuid makes this endpoint an UuidReceiver

func (*Client) Walk

func (c *Client) Walk(walknFc model.WalkNodesFunc, root string, recursive bool) (err error)

func (*Client) Watch

func (c *Client) Watch(recursivePath string) (*model.WatchObject, error)

type MockableMinio

type MockableMinio interface {
	StatObject(bucket string, path string, opts minio.StatObjectOptions) (minio.ObjectInfo, error)
	RemoveObject(bucket string, path string) error
	PutObject(bucket string, path string, reader io.Reader, size int64, opts minio.PutObjectOptions) (n int64, err error)
	GetObject(bucket string, path string, opts minio.GetObjectOptions) (object *minio.Object, err error)
	ListObjectsV2(bucketName, objectPrefix string, recursive bool, doneCh <-chan struct{}) <-chan minio.ObjectInfo
	CopyObject(dest minio.DestinationInfo, source minio.SourceInfo) error
	ListenBucketNotification(bucketName, prefix, suffix string, events []string, doneCh <-chan struct{}) <-chan minio.NotificationInfo
	ListBuckets() ([]minio.BucketInfo, error)
	BucketExists(string) (bool, error)
}

type S3FileInfo

type S3FileInfo struct {
	Object minio.ObjectInfo
	// contains filtered or unexported fields
}

func NewS3FileInfo

func NewS3FileInfo(object minio.ObjectInfo) *S3FileInfo

func NewS3FolderInfo

func NewS3FolderInfo(object minio.ObjectInfo) *S3FileInfo

func (*S3FileInfo) IsDir

func (s *S3FileInfo) IsDir() bool

abbreviation for Mode().IsDir()

func (*S3FileInfo) ModTime

func (s *S3FileInfo) ModTime() time.Time

modification time

func (*S3FileInfo) Mode

func (s *S3FileInfo) Mode() os.FileMode

file mode bits

func (*S3FileInfo) Name

func (s *S3FileInfo) Name() string

base name of the file

func (*S3FileInfo) Size

func (s *S3FileInfo) Size() int64

length in bytes for regular files; system-dependent for others

func (*S3FileInfo) Sys

func (s *S3FileInfo) Sys() interface{}

underlying data source (can return nil)

Jump to

Keyboard shortcuts

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