Documentation
¶
Overview ¶
Package repodispatch routes requests for proxy and group repositories to the proxy and group services. It is installed as chi middleware in front of the per-format routes of /repos/.../{name}: requests for hosted repositories pass straight through to the format handlers, everything else is served here.
Index ¶
- type Authorizer
- type Dispatcher
- func (d *Dispatcher) Middleware(next http.Handler) http.Handler
- func (d *Dispatcher) OCIMiddleware(next http.Handler) http.Handler
- func (d *Dispatcher) WithApkKeys(keys formatapk.KeyProvider) *Dispatcher
- func (d *Dispatcher) WithBaseURL(baseURL string) *Dispatcher
- func (d *Dispatcher) WithDeployRouters(routers map[string]http.Handler) *Dispatcher
- func (d *Dispatcher) WithGroupMetadata(blobs storage.BlobStore, gen group.MetadataGenerator) *Dispatcher
- func (d *Dispatcher) WithNixKeys(keys formatnix.KeyProvider) *Dispatcher
- type DispatcherStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authorizer ¶
type Authorizer interface {
Evaluate(ctx context.Context, principal auth.Principal, repoName, artifactPath, action string) (bool, error)
}
Authorizer decides whether the principal may perform action on artifactPath of repoName. *auth.Evaluator implements it.
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher serves proxy and group repositories.
func New ¶
func New(log *logger.Logger, db DispatcherStore, proxySvc *proxy.Service, authz Authorizer, hosted map[string]http.Handler) *Dispatcher
New creates a Dispatcher.
func (*Dispatcher) Middleware ¶
func (d *Dispatcher) Middleware(next http.Handler) http.Handler
Middleware serves the request itself when the {name} repository is a proxy or group, and otherwise hands it to next.
func (*Dispatcher) OCIMiddleware ¶ added in v0.6.0
func (d *Dispatcher) OCIMiddleware(next http.Handler) http.Handler
OCIMiddleware is Middleware for the registry routes (/v2/<name>/...): a docker proxy or group repository addressed by the first segment of the distribution name is served here; hosted repositories (and anything that is not a repository path, such as GET /v2/) fall through to the registry.
func (*Dispatcher) WithApkKeys ¶ added in v0.13.0
func (d *Dispatcher) WithApkKeys(keys formatapk.KeyProvider) *Dispatcher
WithApkKeys enables the public key downloads of apk groups: keys resolves the key a group's merged indexes are signed with.
func (*Dispatcher) WithBaseURL ¶ added in v0.6.0
func (d *Dispatcher) WithBaseURL(baseURL string) *Dispatcher
WithBaseURL sets the explicit BASE_URL override (empty when the operator set none) for the origin of rewritten metadata such as npm tarball URLs; without it the origin follows the request (see internal/publicurl).
func (*Dispatcher) WithDeployRouters ¶ added in v0.26.0
func (d *Dispatcher) WithDeployRouters(routers map[string]http.Handler) *Dispatcher
WithDeployRouters enables the deploy target of groups: writes sent to a group that names one are served by the hosted member through the routers, one per format that supports it.
func (*Dispatcher) WithGroupMetadata ¶ added in v0.8.0
func (d *Dispatcher) WithGroupMetadata(blobs storage.BlobStore, gen group.MetadataGenerator) *Dispatcher
WithGroupMetadata enables deb, pacman and rpm groups: gen generates their merged metadata, stored in blobs.
func (*Dispatcher) WithNixKeys ¶ added in v0.14.0
func (d *Dispatcher) WithNixKeys(keys formatnix.KeyProvider) *Dispatcher
WithNixKeys enables the signing of nix groups: keys resolves the key of a group, the one its hosted members' narinfo are signed with and its public.key is served from.
type DispatcherStore ¶ added in v0.15.0
type DispatcherStore interface {
GetGroupMetadataState(ctx context.Context, groupID string) (*models.GroupMetadataState, error)
GetGroupPackageOwner(ctx context.Context, groupID string, path string) (string, bool, error)
GetRepoMetadataByPath(ctx context.Context, repositoryID string, path string) (*models.RepoMetadata, error)
GetRepositoryByName(ctx context.Context, name string) (*models.Repository, error)
HasCondaPackageName(ctx context.Context, repoID string, name string) (bool, error)
IvyModuleExists(ctx context.Context, repoID string, organisation string, module string) (bool, error)
ListCondaPackageNames(ctx context.Context, repoID string) ([]string, error)
ListGroupMemberRepositories(ctx context.Context, groupRepoID string) ([]*models.Repository, error)
SBTModuleExists(ctx context.Context, repoID string, groupID string, artifactID string) (bool, error)
}
DispatcherStore is the part of the database Dispatcher needs.