Replace StorageLayer.CurrentSize interface call with Stat

To support single-flight Size and ModTime queries against backend storage file,
we are replacing the CurrentSize call with a Stat call. A FileInfo interface is
provided for backends to provide a type, with a default implementation called
FileInfoInternal, for use by driver implementations.

More work needs to follow this change to update all the driver implementations.
This commit is contained in:
Stephen J Day
2014-12-02 21:00:42 -08:00
parent b047c92e1c
commit ac660e72bf
2 changed files with 82 additions and 4 deletions

View File

@@ -54,10 +54,9 @@ type StorageDriver interface {
// The offset must be no larger than the CurrentSize for this path.
WriteStream(path string, offset, size int64, readCloser io.ReadCloser) error
// CurrentSize retrieves the curernt size in bytes of the object at the
// given path.
// It should be safe to read or write anywhere up to this point.
CurrentSize(path string) (uint64, error)
// Stat retrieves the FileInfo for the given path, including the current
// size in bytes and the creation time.
Stat(path string) (FileInfo, error)
// List returns a list of the objects that are direct descendants of the
//given path.