storage

package
v0.0.0-...-a6721f7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNotFoundError

func IsNotFoundError(err error) bool

IsNotFoundError returns true if err is an ErrNotFound

func IsVersionAlreadyExistsErr

func IsVersionAlreadyExistsErr(err error) bool

IsVersionAlreadyExistsErr returns true if err is an ErrVersionAlreadyExists

Types

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

type ErrVersionAlreadyExists struct {
	Module  string
	Version string
}

ErrVersionAlreadyExists is an error implementation that indicates that a module@version already exists

func (ErrVersionAlreadyExists) Error

func (e ErrVersionAlreadyExists) Error() string

type ErrVersionNotFound

type ErrVersionNotFound struct {
	Module  string
	Version string
}

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(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(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"`
}

type Reader

type Reader struct {
	Lister
	Getter
}

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(module, version string, mod, zip []byte) error
}

Saver saves module metadata and its source to underlying storage

type Storage

type Storage interface {
	Lister
	Getter
	Saver
}

Storage is a complete storage implementation - a lister, reader and saver

type StorageConnector

type StorageConnector interface {
	Storage
	Connect() error
}

StorageConnector is a regular storage with Connect functionality

func NoOpStorageConnector

func NoOpStorageConnector(s Storage) StorageConnector

NoOpStorageConnector wraps storage with Connect functionality

type Version

type Version struct {
	RevInfo RevInfo
	Mod     []byte
	Zip     io.ReadCloser
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL