rclone: github.com/ncw/rclone/fs/object Index | Files

package object

import "github.com/ncw/rclone/fs/object"

Package object defines some useful Objects


Package Files



var MemoryFs memoryFs

MemoryFs is an in memory Fs, it only supports FsInfo and Put

func NewStaticObjectInfo Uses

func NewStaticObjectInfo(remote string, modTime time.Time, size int64, storable bool, hashes map[hash.Type]string, fs fs.Info) fs.ObjectInfo

NewStaticObjectInfo returns a static ObjectInfo If hashes is nil and fs is not nil, the hash map will be replaced with empty hashes of the types supported by the fs.

type MemoryObject Uses

type MemoryObject struct {
    // contains filtered or unexported fields

MemoryObject is an in memory object

func NewMemoryObject Uses

func NewMemoryObject(remote string, modTime time.Time, content []byte) *MemoryObject

NewMemoryObject returns an in memory Object with the modTime and content passed in

func (*MemoryObject) Content Uses

func (o *MemoryObject) Content() []byte

Content returns the underlying buffer

func (*MemoryObject) Fs Uses

func (o *MemoryObject) Fs() fs.Info

Fs returns read only access to the Fs that this object is part of

func (*MemoryObject) Hash Uses

func (o *MemoryObject) Hash(ctx context.Context, h hash.Type) (string, error)

Hash returns the requested hash of the contents

func (*MemoryObject) ModTime Uses

func (o *MemoryObject) ModTime(ctx context.Context) time.Time

ModTime returns the modification date of the file

func (*MemoryObject) Open Uses

func (o *MemoryObject) Open(ctx context.Context, options ...fs.OpenOption) (io.ReadCloser, error)

Open opens the file for read. Call Close() on the returned io.ReadCloser

func (*MemoryObject) Remote Uses

func (o *MemoryObject) Remote() string

Remote returns the remote path

func (*MemoryObject) Remove Uses

func (o *MemoryObject) Remove(ctx context.Context) error

Remove this object

func (*MemoryObject) SetModTime Uses

func (o *MemoryObject) SetModTime(ctx context.Context, modTime time.Time) error

SetModTime sets the metadata on the object to set the modification date

func (*MemoryObject) Size Uses

func (o *MemoryObject) Size() int64

Size returns the size of the file

func (*MemoryObject) Storable Uses

func (o *MemoryObject) Storable() bool

Storable says whether this object can be stored

func (*MemoryObject) String Uses

func (o *MemoryObject) String() string

String returns a description of the Object

func (*MemoryObject) Update Uses

func (o *MemoryObject) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error)

Update in to the object with the modTime given of the given size

This re-uses the internal buffer if at all possible.

Package object imports 8 packages (graph) and is imported by 37 packages. Updated 2019-10-03. Refresh now. Tools for package owners.