Documentation ¶
Index ¶
- func IsNotFoundError(err error) bool
- func IsVersionAlreadyExistsErr(err error) bool
- type Backend
- type BackendConnector
- type Checker
- type Connector
- type Deleter
- type ErrNotFound
- type ErrVersionAlreadyExists
- type ErrVersionNotFound
- type Getter
- type Lister
- type Module
- type Reader
- type RevInfo
- type Saver
- type TestSuite
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNotFoundError ¶
IsNotFoundError returns true if err is an ErrNotFound
func IsVersionAlreadyExistsErr ¶
IsVersionAlreadyExistsErr returns true if err is an ErrVersionAlreadyExists
Types ¶
type Backend ¶
Backend is a complete storage backend (i.e. file system, database) implementation - a lister, reader and saver
type BackendConnector ¶
BackendConnector is a regular storage backend with Connect functionality
func NoOpBackendConnector ¶
func NoOpBackendConnector(b Backend) BackendConnector
NoOpBackendConnector wraps storage backend with Connect functionality
type Checker ¶
type Checker interface { // Exists checks whether or not module in specified version is present // in the backing storage Exists(ctx context.Context, module, version string) bool }
Checker is the interface that checks if the version of the module exists
type Connector ¶
type Connector interface { // Connect connects storage to its backing engine Connect() error }
Connector connects storage to its backing engine
type Deleter ¶
type Deleter interface { // Delete must return ErrVersionNotFound if the module/version are not // found. Delete(ctx context.Context, module, vsn string) error }
Deleter deletes module metadata and its source from underlying storage
type ErrNotFound ¶
type ErrNotFound struct {
Module string
}
ErrNotFound is an error implementation that indicates a module doesn't exist
func (ErrNotFound) Error ¶
func (n ErrNotFound) Error() string
type ErrVersionAlreadyExists ¶
ErrVersionAlreadyExists is an error implementation that indicates that a module@version already exists
func (ErrVersionAlreadyExists) Error ¶
func (e ErrVersionAlreadyExists) Error() string
type ErrVersionNotFound ¶
ErrVersionNotFound is an error implementation that indicates a module at a specific version doesn't exist
func (ErrVersionNotFound) Error ¶
func (e ErrVersionNotFound) Error() string
type Getter ¶
type Getter interface { // Get must return ErrNotFound if the coordinates are not found Get(ctx context.Context, module, vsn string) (*Version, error) }
Getter gets module metadata and its source from underlying storage
type Lister ¶
type Lister interface { // List gets all the versions for the given baseURL & module. // It returns ErrNotFound if the module isn't found List(ctx context.Context, module string) ([]string, error) }
Lister is the interface that lists versions of a specific baseURL & module
type Module ¶
type Module struct { Module string `bson:"module"` Version string `bson:"version"` Mod []byte `bson:"mod"` Zip []byte `bson:"zip"` Info []byte `bson:"info"` }
Module represents a vgo module saved in a storage backend.
type RevInfo ¶
type RevInfo struct { Version string `json:"Version"` // version string Name string `json:"Name"` // complete ID in underlying repository Short string `json:"Short"` // shortened ID, for use in pseudo-version Time time.Time `json:"Time"` // commit time }
RevInfo is json-encodable into the response body for GET baseURL/module/@v/version.info
This struct is taken directly from https://research.swtch.com/vgo-module (see "Download Protocol" header)
type Saver ¶
type Saver interface {
Save(ctx context.Context, module, version string, mod []byte, zip io.Reader, info []byte) error
}
Saver saves module metadata and its source to underlying storage