Commit graph

24 commits

Author SHA1 Message Date
Stephen J Day
0270bec916 Handle empty blob files more appropriately
Several API tests were added to ensure correct acceptance of zero-size and
empty tar files. This led to several changes in the storage backend around the
guarantees of remote file reading, which backs the layer and layer upload type.

In support of these changes, zero-length and empty checks have been added to
the digest package. These provide a sanity check against upstream tarsum
changes. The fileReader has been modified to be more robust when reading and
seeking on zero-length or non-existent files. The file no longer needs to exist
for the reader to be created. Seeks can now move beyond the end of the file,
causing reads to issue an io.EOF. This eliminates errors during certain race
conditions for reading files which should be detected by stat calls. As a part
of this, a few error types were factored out and the read buffer size was
increased to something more reasonable.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2015-02-02 13:01:49 -08:00
Stephen J Day
c080c40030 Remove erroneous error code on layer upload delete
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2015-01-29 20:44:22 -08:00
Stephen Day
fdea60af05 Merge pull request #24 from stevvooe/breakup-common
Breakup common package
2015-01-06 10:08:10 -08:00
Stephen J Day
d88884c51c Move names regular expressions to api/v2 packages
Because the repository name definitions are part of the v2 specification, they
have been moved out of the common package. This is part of the effort to break
up the common package into more sensible components.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2015-01-05 16:44:03 -08:00
Stephen J Day
9c14404630 Address minor typos in response descriptions
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2015-01-02 11:39:43 -08:00
Stephen J Day
80816100e2 Fill in API detail in RouteDescriptors
This changeset fills in details for many RouteDescriptors, ensuring that
responses and their variation are fully covered. At this point, all endpoints
are described in full. Tweaks for consistency and to avoid repetition may still
need to be done.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2015-01-02 10:49:10 -08:00
Stephen J Day
83b899dab6 Add blob upload invalid error code 2015-01-02 10:49:10 -08:00
Olivier Gambier
67ca9d10cf Move from docker-registry to distribution 2014-12-23 17:13:02 -08:00
Olivier Gambier
6612be9acb Merge pull request #868 from stevvooe/ng-api-specification
[WIP] Automatically generate V2 API specification
2014-12-23 15:14:39 -08:00
Stephen J Day
e32b1e66f3 Simplify parameter descriptor declarations 2014-12-18 21:39:56 -08:00
Stephen J Day
06ebc514a7 Automatically generate V2 API specification
This changeset provides data structures and definitions describing the routes
available in the V2 registry API. These route descriptors are structured to
provide automated registration, for creating routers, in addition to complete
documentation duty. It's also a possibility that this could be used to
enumerate test coverage for server implementation.

Using this functionality, we've also developed a template to automatically
generate and API specification for submission into docker core.
2014-12-18 21:29:56 -08:00
Stephen J Day
d0a9e9b475 Integrate auth.AccessController into registry app
This changeset integrates the AccessController into the main registry app. This
includes support for configuration and a test implementation, called "silly"
auth. Auth is only enabled if the configuration is present but takes measure to
ensure that configuration errors don't allow the appserver to start with open
access.
2014-12-18 12:34:56 -08:00
Stephen J Day
3916938481 Add tests for URLBuilder 2014-12-12 15:48:41 -08:00
Stephen J Day
bb300231d0 Allow variadic url values for BuildBlobUploadURL
URL values may be required to complete an upload in a single POST request,
which may include digest and size. This is not implemented in the server side,
yet, but is part of the HTTP API specification.
2014-12-12 15:36:16 -08:00
Stephen J Day
d08f0edcf1 Migrate references to consolidated v2 package
Routes and errors are now all referenced from a single v2 package. This
packages exports are acceptable for use in the server side as well as
integration into docker core.
2014-12-12 15:36:15 -08:00
Stephen J Day
5abfc91021 Merge errors and urls package into unified v2 package
To provide a single package with v2 API definitions, the locked down portions
of the API have been merged into a single package. References to exported items
will appear as v2.XXX, indicating their origin. The definitions in this package
will soon be locked down for change, acceppting only additions that will not
change protocol behavior.
2014-12-12 15:36:15 -08:00
Stephen J Day
92dca269f0 Change errors export from Descriptors to ErrorDescriptors 2014-12-12 15:36:15 -08:00
Stephen J Day
e14e5d14b1 Correct documentation errors in urls package 2014-12-12 15:36:15 -08:00
Stephen J Day
9b872ca150 Prepare urls.URLBuilder package for export
The URLBuilder is now exported with documentation for its behavior. Its a light
wrapper around gorilla mux that avoids one having to remember exact arguments
take by each route.
2014-12-12 15:36:15 -08:00
Stephen J Day
e5b6da80d0 Move urls.go into urls package 2014-12-12 15:36:15 -08:00
Stephen J Day
da19114d1a Prepare urls package for exports
The route definition files have been prepared for export with documentation.
Consts have been updated and tests are now passing for the urls package.
2014-12-12 15:36:15 -08:00
Stephen J Day
c78d173cf7 Move routes to urls package
To lock down V2 api routing, we are moving it to a separate package, with an
exported router creation function and route names. Updates will follow to
prepare the package for export.
2014-12-12 15:36:15 -08:00
Stephen J Day
b721b0a15c Export error descriptors and provide tool generate markdown table
To support accurate specification generation, this changeset includes a quick
and dirty tool to generate a markdown table of error codes generated by the
registry API. Equivalent supports for routes will likely follow.

Exported descriptors could be used to generate other documentation, as well.
2014-12-10 16:41:43 -08:00
Stephen J Day
7b56d10076 Lock down HTTP API error codes
This commit locks down the set of http error codes that will be part of the
inital V2 specification, proposed in docker/docker#9015. The naming order has
been slightly changed and there are few tweaks to ensure all conditions are
captured but this will be set the docker core will be impleemnted against.

To support this, the errors have been moved into an api/errors package. A new
type, ErrorDescriptor, has been defined to centralize the code, message and
definitions used with each type. The information therein can be used to
generate documentation and response code mappings (yet to come...).

In addition to the refactoring that came along with this change, several tests
have been added to ensure serialization round trips are reliable. This allows
better support for using these error types on the client and server side. This
is coupled with some tweaks in the client code to fix issues with error
reporting.

Other fixes in the client include moving client-specific errors out of the base
package and ensuring that we have correct parameters for finishing uploads.
2014-12-10 11:49:04 -08:00