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.
Initial implementation of Manifest HTTP API

Push, pull and delete of manifest files in the registry have been implemented
on top of the storage services. Basic workflows, including reporting of missing
manifests are tested, including various proposed response codes. Common testing
functionality has been collected into shared methods. A test suite may be
emerging but it might better to capture more edge cases (such as resumable
upload, range requests, etc.) before we commit to a full approach.

To support clearer test cases and simpler handler methods, an application aware
urlBuilder has been added. We may want to export the functionality for use in
the client, which could allow us to abstract away from gorilla/mux.

A few error codes have been added to fill in error conditions missing from the
proposal. Some use cases have identified some problems with the approach to
error reporting that requires more work to reconcile. To resolve this, the
mapping of Go errors into error types needs to pulled out of the handlers and
into the application. We also need to move to type-based errors, with rich
information, rather than value-based errors. ErrorHandlers will probably
replace the http.Handlers to make this work correctly.

Unrelated to the above, the "length" parameter has been migrated to "size" for
completing layer uploads. This change should have gone out before but these
diffs ending up being coupled with the parameter name change due to updates to
the layer unit tests.
Address race condition in client tests (closes #784)
Merge pull request #792 from stevvooe/next-generation

Initial implementation of Manifest HTTP API
Merge pull request #794 from stevvooe/ng-client-race-condition

Address race condition in client tests (closes #784)
Create copy of buffer for SignedManifest.Raw

Without this copy, the buffer may be re-used in the json package, causing
missing or corrupted content for the long-lived SignedManifest object. By
creating a new buffer, owned by the SignedManifest object, the content remains
stable.
Use json.MashalIndent for raw manifest json

This provides compatibility with what is in docker core, ensuring that image
manifests generated here have the same formatting. We'll need to automate this
some how.
Cleanup image verification error handling

This diff removes a few early outs that caused errors to be unreported and
catches a missed error case for signature verification from libtrust. More work
needs to be done around ensuring consistent error handling but this is enough
to make the API work correctly.
Avoid manifest verification errors by using Raw

Because json.Marshal does compaction on returned results, applications must
directly use SignedManifest.Raw when the marshaled value is required.
Otherwise, the returned manifest will fail signature checks.
configuration.Parse should take io.Reader
Add registry main cmd
Add TODO about manifest tampering test
StorageDrivers should exit non-zero on error (closes #803)
Azure storage driver implementation

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
Merge pull request #805 from stevvooe/ng-manifest-bugs

NG: Various Manifest Oriented bugfixes
Merge pull request #807 from stevvooe/ng-nonzero-exit-error

StorageDrivers should exit non-zero on error (closes #803)
Merge pull request #806 from stevvooe/ng-registry-main

NG: Add registry main cmd
Merge pull request #801 from ahmetalpbalkan/next-generation-azure-storagedriver

NG: Microsoft Azure storage driver