Refactor layerReader into fileReader

This change separates out the remote file reader functionality from layer
reprsentation data. More importantly, issues with seeking have been fixed and
thoroughly tested.
Update error declarations and add missing test

This updates API error codes to coincide with changes to the proposal. Mostly,
redundant error codes were merged and missing ones were added. The set in the
main errors.go file will flow back into the specification.

A test case has been added to ensure ErrorCodeUnknown is included in marshaled
json.
Initial implementation of Layer API

The http API has its first set of endpoints to implement the core aspects of
fetching and uploading layers. Uploads can be started and completed in a single
chunk and the content can be fetched via tarsum. Most proposed error conditions
should be represented but edge cases likely remain.

In this version, note that the layers are still called layers, even though the
routes are pointing to blobs. This will change with backend refactoring over
the next few weeks.

The unit tests are a bit of a shamble but these need to be carefully written
along with the core specification process. As the the client-server interaction
solidifies, we can port this into a verification suite for registry providers.
Implement path spec for manifest storage
Move Manifest type into storage package

This changeset move the Manifest type into the storage package to make the type
accessible to client and registry without import cycles. The structure of the
manifest was also changed to accuratle reflect the stages of the signing
process. A straw man Manifest.Sign method has been added to start testing this
concept out but will probably be accompanied by the more import
SignedManifest.Verify method as the security model develops.

This is probably the start of a concerted effort to consolidate types across
the client and server portions of the code base but we may want to see how such
a handy type, like the Manifest and SignedManifest, would work in docker core.
Merge pull request #769 from stevvooe/layer-http-api

Initial implementation of Layer API
[IPC] Tiny cleaning
Merge pull request #776 from noxiouz/tiny_cleaninig

[IPC] Tiny cleaning
Merge pull request #774 from docker/test-drone

Fix goverall
Initial implementation of image manifest storage

This change implements the first pass at image manifest storage on top of the
storagedriver. Very similar to LayerService, its much simpler due to less
complexity of pushing and pulling images.

Various components are still missing, such as detailed error reporting on
missing layers during verification, but the base functionality is present.
Allows layers to be partially pulled and resumed

Adds a sort of contrived test for resumable pulls
Merge pull request #750 from BrianBland/ng-push-pull

Allows layers to be partially pulled and resumed
Merge pull request #780 from stevvooe/manifest-storage

Initial implementation of image manifest storage
Correct references after move of Manifest into storage package
Merge pull request #783 from stevvooe/next-generation

Correct references after move of Manifest into storage package
Clean up layer storage layout

Previously, discussions were still ongoing about different storage layouts that
could support various access models. This changeset removes a layer of
indirection that was in place due to earlier designs. Effectively, this both
associates a layer with a named repository and ensures that content cannot be
accessed across repositories. It also moves to rely on tarsum as a true
content-addressable identifier, removing a layer of indirection during blob
resolution.
Merge pull request #782 from stevvooe/cleanup-storage-mapping

Clean up layer storage layout
Fix read offset check for inmemory driver

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
Merge pull request #787 from ahmetalpbalkan/next-generation

NG: Fix read offset check for inmemory driver
Rich error reporting for manifest push

To provide rich error reporting during manifest pushes, the storage layers
verifyManifest stage has been modified to provide the necessary granularity.
Along with this comes with a partial shift to explicit error types, which
represents a small move in larger refactoring of error handling. Signature
methods from libtrust have been added to the various Manifest types to clean up
the verification code.

A primitive deletion implementation for manifests has been added. It only
deletes the manifest file and doesn't attempt to add some of the richer
features request, such as layer cleanup.