metadata

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CDNMetadataEntry

type CDNMetadataEntry struct {
	ID          uuid.UUID `json:"id" db:"id" bson:"id"`
	CreatedAt   time.Time `json:"created_at" db:"created_at" bson:"created_at"`
	UpdatedAt   time.Time `json:"updated_at" db:"updated_at" bson:"updated_at"`
	Module      string    `json:"module" db:"module" bson:"module"`
	RedirectURL string    `json:"redirect_url" db:"redirect_url" bson:"redirect_url"`
}

CDNMetadataEntry stores the module name and cdn URL.

func (CDNMetadataEntry) String

func (e CDNMetadataEntry) String() string

String is not required by pop and may be deleted

func (*CDNMetadataEntry) TableName

func (e *CDNMetadataEntry) TableName() string

TableName changes the default name which would be c_d_n_metadata_entry

func (*CDNMetadataEntry) Validate

func (e *CDNMetadataEntry) Validate(tx *pop.Connection) (*validate.Errors, error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method. This method is not required and may be deleted.

func (*CDNMetadataEntry) ValidateCreate

func (e *CDNMetadataEntry) ValidateCreate(tx *pop.Connection) (*validate.Errors, error)

ValidateCreate gets run every time you call "pop.ValidateAndCreate" method. This method is not required and may be deleted.

func (*CDNMetadataEntry) ValidateUpdate

func (e *CDNMetadataEntry) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error)

ValidateUpdate gets run every time you call "pop.ValidateAndUpdate" method. This method is not required and may be deleted.

type CdnMetadataEntries

type CdnMetadataEntries []CDNMetadataEntry

CdnMetadataEntries is not required by pop and may be deleted

type Getter

type Getter interface {
	// Get gets the base URL for the given module.
	// Returns ErrNotFound if the module isn't found, and another
	// non-nil error on any other error encountered.
	//
	// This method does not touch the CDN itself. Olympus should just
	// redirect vgo to the CDN so that vgo downloads module data directly
	// from there.
	//
	// If something went wrong getting the module metadata, returns a non-nil
	// error.
	Get(module string) (string, error)
}

Getter gets the details about a given module and returns the base URL of the module metadata and content. For example, if gomods.io/my/module is requested by the 'vgo get' command, this might return 'https://mycdn.com/gomods.io/my/module'

Then, the following URLs would be available:

- https://mycdn.com/gomods.io/my/module/@v/list - https://mycdn.com/gomods.io/my/module/@v/{version}.info - https://mycdn.com/gomods.io/my/module/@v/{version}.mod - https://mycdn.com/gomods.io/my/module/@v/{version}.zip

type Saver

type Saver interface {
	// Save saves the module and base URL pair.
	Save(module, redirectURL string) error
}

Saver saves the module's base URL of the module metadata and content. For example: module: gomods.io/my/module - URL: 'https://mycdn.com/gomods.io/my/module'

type Storage

type Storage interface {
	Getter
	Saver
}

Storage is a complete cdn metadata storage backend (i.e. file system, database) implementation - a getter and saver

type StorageConnector

type StorageConnector interface {
	Storage
	Connect() error
}

StorageConnector is a regular storage Storage with Connect functionality

func NoOpStorageConnector

func NoOpStorageConnector(s Storage) StorageConnector

NoOpStorageConnector wraps storage Storage with Connect functionality

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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