Documentation
¶
Index ¶
- Variables
- type Publication
- type Service
- func (service *Service) Publish(ctx context.Context, principal authn.Principal, repositoryID int64, ...) (api.GraphPublicationResult, error)
- func (service *Service) Status(ctx context.Context, principal authn.Principal, repositoryID int64) (api.GraphStatus, error)
- func (service *Service) UploadExternal(ctx context.Context, principal authn.Principal, repositoryID int64, ...) (api.GraphStatus, error)
- func (service *Service) ValidateExternalUpload(ctx context.Context, principal authn.Principal, repositoryID int64, ...) error
- func (service *Service) ValidatePublication(ctx context.Context, principal authn.Principal, repositoryID int64, ...) error
- type Store
Constants ¶
This section is empty.
Variables ¶
var ( ErrForbidden = errors.New("forbidden") ErrNotIndexed = errors.New("not_indexed") ErrInvalidArtifact = errors.New("invalid_artifact") // ErrConflict means the active generation or indexed commit no longer // matches the publisher's preflight; ErrProducerConflict means the active // generation came from another producer and replacement was not requested. ErrConflict = errors.New("conflict") ErrProducerConflict = errors.New("producer_conflict") ErrUnauthenticated = errors.New("unauthenticated") )
Functions ¶
This section is empty.
Types ¶
type Publication ¶ added in v0.7.0
Publication is a v2 publisher's replacement intent from its preflight. ExpectedGeneration 0 means no generation was active.
type Service ¶
type Service struct {
Store Store
Limits graphartifact.Limits
// MaxUploadBytes is reported to publishers; the transport enforces it.
MaxUploadBytes int64
}
func (*Service) Publish ¶ added in v0.7.0
func (service *Service) Publish(ctx context.Context, principal authn.Principal, repositoryID int64, commit string, data []byte, intent Publication) (api.GraphPublicationResult, error)
Publish activates a v2 artifact. Administrators need no grant; everyone else needs a repository publication grant on top of read access. The credential, grant and indexed commit are rechecked after parsing, and storage compares the expected generation under the repository lock.
func (*Service) UploadExternal ¶
func (*Service) ValidateExternalUpload ¶
func (*Service) ValidatePublication ¶ added in v0.7.0
func (service *Service) ValidatePublication(ctx context.Context, principal authn.Principal, repositoryID int64, commit string) error
ValidatePublication checks, before the body is read, that the principal may publish a v2 generation for the repository's indexed commit.
type Store ¶
type Store interface {
AuthorizedRepository(context.Context, int64, []int64, int64) (repository.Repository, error)
ReplaceGraph(context.Context, int64, postgres.GraphSource, graphartifact.Artifact) (postgres.GraphReplacement, error)
GraphStatus(context.Context, int64) (api.GraphStatus, error)
ReplaceGraphV2(context.Context, int64, postgres.GraphPublication, *graphv2.Artifact) (postgres.GraphReplacement, error)
ActiveGraphGeneration(context.Context, int64) (*api.GraphActiveGeneration, error)
GraphPublicationAllowed(context.Context, int64, string) (bool, error)
}