Documentation ¶
Overview ¶
Package object defines some useful Objects
Index ¶
- Variables
- type MemoryObject
- func (o *MemoryObject) Content() []byte
- func (o *MemoryObject) Fs() fs.Info
- func (o *MemoryObject) Hash(ctx context.Context, h hash.Type) (string, error)
- func (o *MemoryObject) Metadata(ctx context.Context) (fs.Metadata, error)
- func (o *MemoryObject) ModTime(ctx context.Context) time.Time
- func (o *MemoryObject) Open(ctx context.Context, options ...fs.OpenOption) (io.ReadCloser, error)
- func (o *MemoryObject) Remote() string
- func (o *MemoryObject) Remove(ctx context.Context) error
- func (o *MemoryObject) SetFs(f fs.Fs) *MemoryObject
- func (o *MemoryObject) SetModTime(ctx context.Context, modTime time.Time) error
- func (o *MemoryObject) Size() int64
- func (o *MemoryObject) Storable() bool
- func (o *MemoryObject) String() string
- func (o *MemoryObject) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error)
- func (o *MemoryObject) WithMetadata(meta fs.Metadata) *MemoryObject
- type StaticObjectInfo
- func (i *StaticObjectInfo) Fs() fs.Info
- func (i *StaticObjectInfo) Hash(ctx context.Context, h hash.Type) (string, error)
- func (i *StaticObjectInfo) Metadata(ctx context.Context) (fs.Metadata, error)
- func (i *StaticObjectInfo) MimeType(ctx context.Context) string
- func (i *StaticObjectInfo) ModTime(ctx context.Context) time.Time
- func (i *StaticObjectInfo) Remote() string
- func (i *StaticObjectInfo) Size() int64
- func (i *StaticObjectInfo) Storable() bool
- func (i *StaticObjectInfo) String() string
- func (i *StaticObjectInfo) WithMetadata(meta fs.Metadata) *StaticObjectInfo
- func (i *StaticObjectInfo) WithMimeType(mimeType string) *StaticObjectInfo
Constants ¶
This section is empty.
Variables ¶
var MemoryFs memoryFs
MemoryFs is an in memory Fs, it only supports FsInfo and Put
Functions ¶
This section is empty.
Types ¶
type MemoryObject ¶
type MemoryObject struct {
// contains filtered or unexported fields
}
MemoryObject is an in memory object
func NewMemoryObject ¶
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 ¶
func (o *MemoryObject) Content() []byte
Content returns the underlying buffer
func (*MemoryObject) Fs ¶
func (o *MemoryObject) Fs() fs.Info
Fs returns read only access to the Fs that this object is part of
func (*MemoryObject) ModTime ¶
func (o *MemoryObject) ModTime(ctx context.Context) time.Time
ModTime returns the modification date of the file
func (*MemoryObject) Open ¶
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) Remove ¶
func (o *MemoryObject) Remove(ctx context.Context) error
Remove this object
func (*MemoryObject) SetFs ¶
func (o *MemoryObject) SetFs(f fs.Fs) *MemoryObject
SetFs sets the Fs that this memory object thinks it is part of It will ignore nil f
func (*MemoryObject) SetModTime ¶
SetModTime sets the metadata on the object to set the modification date
func (*MemoryObject) Storable ¶
func (o *MemoryObject) Storable() bool
Storable says whether this object can be stored
func (*MemoryObject) String ¶
func (o *MemoryObject) String() string
String returns a description of the Object
func (*MemoryObject) Update ¶
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.
func (*MemoryObject) WithMetadata ¶
func (o *MemoryObject) WithMetadata(meta fs.Metadata) *MemoryObject
WithMetadata adds meta to the MemoryObject
type StaticObjectInfo ¶
type StaticObjectInfo struct {
// contains filtered or unexported fields
}
StaticObjectInfo is an ObjectInfo which can be constructed from scratch
func NewStaticObjectInfo ¶
func NewStaticObjectInfo(remote string, modTime time.Time, size int64, storable bool, hashes map[hash.Type]string, f fs.Info) *StaticObjectInfo
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.
func (*StaticObjectInfo) Fs ¶
func (i *StaticObjectInfo) Fs() fs.Info
Fs returns read only access to the Fs that this object is part of
func (*StaticObjectInfo) MimeType ¶
func (i *StaticObjectInfo) MimeType(ctx context.Context) string
MimeType returns the content type of the Object if known, or "" if not
func (*StaticObjectInfo) ModTime ¶
func (i *StaticObjectInfo) ModTime(ctx context.Context) time.Time
ModTime returns the modification date of the file
func (*StaticObjectInfo) Remote ¶
func (i *StaticObjectInfo) Remote() string
Remote returns the remote path
func (*StaticObjectInfo) Size ¶
func (i *StaticObjectInfo) Size() int64
Size returns the size of the file
func (*StaticObjectInfo) Storable ¶
func (i *StaticObjectInfo) Storable() bool
Storable says whether this object can be stored
func (*StaticObjectInfo) String ¶
func (i *StaticObjectInfo) String() string
String returns a description of the Object
func (*StaticObjectInfo) WithMetadata ¶
func (i *StaticObjectInfo) WithMetadata(meta fs.Metadata) *StaticObjectInfo
WithMetadata adds meta to the ObjectInfo
func (*StaticObjectInfo) WithMimeType ¶
func (i *StaticObjectInfo) WithMimeType(mimeType string) *StaticObjectInfo
WithMimeType adds meta to the ObjectInfo