Documentation ¶
Overview ¶
Package object defines some useful Objects
Index ¶
- Variables
- func NewStaticObjectInfo(remote string, modTime time.Time, size int64, storable bool, ...) fs.ObjectInfo
- 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) 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) 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)
Constants ¶
This section is empty.
Variables ¶
var MemoryFs memoryFs
MemoryFs is an in memory Fs, it only supports FsInfo and Put
Functions ¶
func NewStaticObjectInfo ¶
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.
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) 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.