Documentation ¶
Index ¶
- Variables
- type ObjectInfo
- type ObjectStorage
- type StorageInfo
- type TraceObjectStorage
- func (self *TraceObjectStorage) Info(getsize bool) (info StorageInfo, err error)
- func (self *TraceObjectStorage) List(prefix string, imarker string, maxcount int) (omarker string, infos []ObjectInfo, err error)
- func (self *TraceObjectStorage) Mkdir(prefix string) (info ObjectInfo, err error)
- func (self *TraceObjectStorage) OpenRead(name string, sig string) (info ObjectInfo, reader io.ReadCloser, err error)
- func (self *TraceObjectStorage) OpenWrite(name string, size int64) (writer WriteWaiter, err error)
- func (self *TraceObjectStorage) Remove(name string) (err error)
- func (self *TraceObjectStorage) Rename(oldname string, newname string) (err error)
- func (self *TraceObjectStorage) Rmdir(prefix string) (err error)
- func (self *TraceObjectStorage) Stat(name string) (info ObjectInfo, err error)
- type WriteWaiter
Constants ¶
This section is empty.
Variables ¶
View Source
var Registry = objreg.NewObjectFactoryRegistry()
Registry is the default object storage factory registry.
Functions ¶
This section is empty.
Types ¶
type ObjectInfo ¶
type ObjectInfo interface { // object name (no path) Name() string // object size Size() int64 // object birth time Btime() time.Time // object modification time Mtime() time.Time // isdir flag IsDir() bool // object signature Sig() string }
ObjectInfo contains information about an object.
type ObjectStorage ¶
type ObjectStorage interface { // Info gets storage information. The getsize parameter instructs the // implementation to also contact the object storage for size information. Info(getsize bool) (StorageInfo, error) // List lists all objects that have names with the specified prefix. // A marker can be used to continue a paginated listing. The listing // will contain up to maxcount items; a 0 specifies no limit (but the // underlying storage may still limit the number of items returned). // List returns an (optionally empty) marker and a slice of ObjectInfo. List(prefix string, marker string, maxcount int) (string, []ObjectInfo, error) // Stat gets object information. Stat(name string) (ObjectInfo, error) // Mkdir makes an object directory if the storage supports it. Mkdir(prefix string) (ObjectInfo, error) // Rmdir removes an object directory if the storage supports it. Rmdir(prefix string) error // Remove deletes an object from storage. Remove(name string) error // Rename renames an object. Rename(oldname string, newname string) error // OpenRead opens an object for reading. If sig is not empty, OpenRead // opens the object only if its current signature is different from sig. // It returns the current object info and an io.ReadCloser or any error; // if the object is not opened because of a matching non-empty sig, a nil // io.ReadCloser and nil error are returned. // // The returned io.ReadCloser may also support the io.ReaderAt interface. OpenRead(name string, sig string) (ObjectInfo, io.ReadCloser, error) // OpenWrite opens an object for writing. The parameter size specifies // the size that the written object will have. OpenWrite(name string, size int64) (WriteWaiter, error) }
ObjectStorage is the interface that an object storage must implement. It provides methods to list, open and manipulate objects.
type StorageInfo ¶
type StorageInfo interface { // determines if the storage is case-insensitive IsCaseInsensitive() bool // determines if the storage is read-only IsReadOnly() bool // maximum object name component length MaxComponentLength() int // total storage size TotalSize() int64 // free storage size FreeSize() int64 }
StorageInfo contains information about the storage.
type TraceObjectStorage ¶
type TraceObjectStorage struct {
ObjectStorage
}
TraceObjectStorage wraps a storage and traces calls to it.
func (*TraceObjectStorage) Info ¶
func (self *TraceObjectStorage) Info(getsize bool) (info StorageInfo, err error)
func (*TraceObjectStorage) List ¶
func (self *TraceObjectStorage) List( prefix string, imarker string, maxcount int) ( omarker string, infos []ObjectInfo, err error)
func (*TraceObjectStorage) Mkdir ¶
func (self *TraceObjectStorage) Mkdir(prefix string) (info ObjectInfo, err error)
func (*TraceObjectStorage) OpenRead ¶
func (self *TraceObjectStorage) OpenRead( name string, sig string) ( info ObjectInfo, reader io.ReadCloser, err error)
func (*TraceObjectStorage) OpenWrite ¶
func (self *TraceObjectStorage) OpenWrite( name string, size int64) ( writer WriteWaiter, err error)
func (*TraceObjectStorage) Remove ¶
func (self *TraceObjectStorage) Remove(name string) (err error)
func (*TraceObjectStorage) Rename ¶
func (self *TraceObjectStorage) Rename(oldname string, newname string) (err error)
func (*TraceObjectStorage) Rmdir ¶
func (self *TraceObjectStorage) Rmdir(prefix string) (err error)
func (*TraceObjectStorage) Stat ¶
func (self *TraceObjectStorage) Stat(name string) (info ObjectInfo, err error)
type WriteWaiter ¶
type WriteWaiter interface { io.WriteCloser Wait() (ObjectInfo, error) }
WriteWaiter wraps a WriteCloser and a Wait method that waits until all transfers are complete. After Wait has been called no further Write's are possible and Close must be called. Calling Close without Wait cancels any pending tranfers.
Click to show internal directories.
Click to hide internal directories.