Commit graph

24 commits

Author SHA1 Message Date
Stephen J Day
f265a29f24 Move shared checks to base storage driver
This changeset moves common checks from driver implementations into base
package. The Base type can be embedded in a driver implementation, ensuring
that incoming arguments are checked for validity.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2015-02-03 17:05:50 -08:00
Brian Bland
abb901e4ab Adds options map for storagedriver URLFor() method 2015-01-08 17:10:32 -08:00
Andrey Kostov
a2b294f444 Add the URLFor optional method to the storagedriver api
We now also have a storagedriver error variable for identifying
api calls that are not implemented by drivers (the URLFor method
is not implemented by either the filesystem or inmemory drivers)
2015-01-07 18:44:01 +02:00
Brian Bland
5880dcfdba Adds basic READMEs to inmemory and filesystem storage drivers 2014-12-29 13:59:40 -08:00
Olivier Gambier
67ca9d10cf Move from docker-registry to distribution 2014-12-23 17:13:02 -08:00
Stephen Day
3b8847f489 Merge pull request #863 from BrianBland/ng-storagedriver
Fixes filesystem storage driver List semantics for nonexistent directory
2014-12-18 10:47:31 -08:00
Brian Bland
030b0ff310 Allows storagedriver parameter values to be of type interface{}
This enables use of nil, booleans, numeric types, and even complex structures for parameter values, assuming they can be parsed from yaml.
2014-12-17 19:06:55 -08:00
Brian Bland
bc8ab9b392 Fixes filesystem storage driver List semantics for nonexistent directory
Now returns a PathNotFoundError
2014-12-17 17:00:18 -08:00
Brian Bland
a7b8e4fda0 Adds benchmarks for Put/Get, WriteStream/ReadStream, List, and Delete
Also fixes an open fd leak in the filesystem driver that these
benchmarks revealed.
2014-12-16 13:00:29 -08:00
Brian Bland
8a1889efeb Enforces a path format for storage drivers (#819)
Requires all paths in the inmemory and filesystem drivers to begin with
a slash, and then contain only valid path components (2+ alphanumeric
characters with optional period, hyphen, and underscore separators)
delimited by slashes.

Also updates the storage driver test suites to construct paths of this
format, and causes the suite to abort if files are not cleaned up after
the test run.
2014-12-11 14:19:41 -08:00
Brian Bland
cacf33ab62 Uses random paths with slashes for storagedriver tests, adds edge cases
This replaces only using flat filenames, to better test nested file
behaviors.
Fixed inmemory/mfs.go and filesystem/driver.go after finding bugs with
the new tests and test behavior.
2014-12-08 19:26:29 -08:00
Stephen J Day
d703a86a64 Add checks for ReadStream offset boundary conditions
Several checks for ReadStream with offset around boundary conditions were
missing. The new checks ensure negative offsets are detected and io.EOF is
returned properly when trying to read past the end of a file. The filesystem
and inmemory driver have been updated accordingly.

An outline of missing checks for List are also part of this commit. Action will
be taken here based on discussion in issue #819.
2014-12-05 11:46:41 -08:00
Stephen J Day
ab9570f872 Migrate filesystem driver to new storagedriver calls
The filesystem driver has been migrated to impleemnt the storagedriver
interface changes. Most interetingly, this provides a filesystem-based
implementation of the Stat driver call. With this comes some refactoring of
Reads and Write to be much simpler and more robust.

The IPC tests have been disabled to stability problems that we'll have to
troubleshoot at a later date.
2014-12-03 16:47:31 -08:00
Stephen J Day
66107df1af Use int64 for ReadStream and WriteStream offsets
This change brings the storagedriver API in line with the Go standard library's
use of int64 for offsets. The main benefit is simplicity in interfacing with
the io library reducing the number of type conversions in simple code.
2014-12-02 19:01:00 -08:00
Brian Bland
68fd15b688 Miscellaneous storagedriver+ipc fixes
Fixes/tests listing for keys beginning with "/"
No longer extraneously wraps Closers in ioutil.NopClosers
Uses omitempty for all ipc struct type fields
2014-11-20 14:14:55 -08:00
Brian Bland
a3481c5f1c Adds ability to unwrap ipc errors into their original type
This only works for a specific whitelist of error types, which is
currently all errors in the storagedriver package.

Also improves storagedriver tests to enforce proper error types are
returned
2014-11-18 17:41:48 -08:00
Brian Bland
88795e0a14 Lots of various golint fixes
Changes some names to match go conventions
Comments all exported methods
Removes dot imports
2014-11-17 15:46:06 -08:00
Brian Bland
c8ea224f9c Miscellaneous go vet fixes
Fixes some format strings and uses keyed fields for struct construction
2014-11-12 17:19:19 -08:00
Brian Bland
cb1bdacbe3 Renames ResumeWritePosition to CurrentSize in storage driver api 2014-11-07 12:58:48 -08:00
Brian Bland
7daa850d44 Fixes documentation to show that StorageDriver.List is non-recursive 2014-11-04 09:52:24 -08:00
Brian Bland
0e5d41ff9b Updates documentation to follow godoc conventions 2014-10-29 16:44:26 -07:00
Brian Bland
ca0084fad1 Adds StorageDriverFactory, unifying creation of StorageDrivers
Custom storage drivers can register a factory to create the driver by
name, similar to the database/sql package's Register and Open
factory.Create returns an in-process driver if registered or an IPC
driver if one can be found, erroring otherwise
This standardizes parameter passing for creation of storage drivers

Also adds documentation for storagedriver package and children
2014-10-28 18:21:06 -07:00
Brian Bland
ff81f3a719 Adds conditional SkipCheck for storage driver tests 2014-10-27 13:24:07 -07:00
Brian Bland
3f95694180 Adds storage driver interface, tests, and two basic implementations 2014-10-22 10:50:43 -07:00