Create Repositories method

This change removes the Catalog Service and replaces it with a more
simplistic Repositories() method for obtaining a catalog of all
repositories.  The Repositories method takes a pre-allocated slice
and fills it up to the size of the slice and returns the amount
filled.  The catalog is returned lexicographically and will start
being filled from the last entry passed to Repositories().  If there
are no more entries to fill, io.EOF will be returned.

Signed-off-by: Patrick Devine <patrick.devine@docker.com>

Conflicts:
	registry/client/repository.go
	registry/handlers/api_test.go
This commit is contained in:
Patrick Devine 2015-07-17 11:42:47 -07:00
parent 74563efe98
commit b7e26bac74
10 changed files with 251 additions and 145 deletions

View file

@ -36,8 +36,11 @@ type Namespace interface {
// reference.
Repository(ctx context.Context, name string) (Repository, error)
// Catalog returns a reference which can be used for listing repositories
Catalog(ctx context.Context) CatalogService
// Repositories fills 'repos' with a lexigraphically sorted catalog of repositories
// up to the size of 'repos' and returns the value 'n' for the number of entries
// which were filled. 'last' contains an offset in the catalog, and 'err' will be
// set to io.EOF if there are no more entries to obtain.
Repositories(ctx context.Context, repos []string, last string) (n int, err error)
}
// ManifestServiceOption is a function argument for Manifest Service methods
@ -115,9 +118,3 @@ type SignatureService interface {
// Put stores the signature for the provided digest.
Put(dgst digest.Digest, signatures ...[]byte) error
}
// CatalogService provides a way of retrieving the names of each of the repositories
type CatalogService interface {
// Get retrieves repository names from the registry.
Get(n int, q string) (p []string, moreEntries bool, err error)
}