index

package
v2.3.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CATEGORY_RUBY    = "ruby"
	CATEGORY_JRUBY   = "jruby"
	CATEGORY_TRUFFLE = "truffle"
	CATEGORY_OTHER   = "other"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ArchData

type ArchData map[string]CategoryData

type CategoryData

type CategoryData []*VersionInfo

func (CategoryData) Total

func (d CategoryData) Total() int

Total returns total number of rubies available for installation

type DistData

type DistData map[string]ArchData

type Index

type Index struct {
	Meta *Metadata           `json:"meta"`
	Data map[string]DistData `json:"data"`
}

func NewIndex

func NewIndex() *Index

NewIndex return pointer to new index struct

func (*Index) Add

func (i *Index) Add(dist, arch, category string, info *VersionInfo)

Add adds info about ruby to index

func (*Index) Encode

func (i *Index) Encode() ([]byte, error)

Encode encodes index to JSON format

func (*Index) Find

func (i *Index) Find(dist, arch, name string) (*VersionInfo, string)

Find tries to find info about version by name

func (*Index) GetCategoryData

func (i *Index) GetCategoryData(dist, arch, category string, eol bool) CategoryData

GetCategoryData returns data for given dist, arch and category

func (*Index) HasData

func (i *Index) HasData(dist, arch string) bool

HasData returns true if index contains data for some dist + arch

func (*Index) Sort

func (i *Index) Sort()

Sort sorts versions data

func (*Index) UpdateMetadata

func (i *Index) UpdateMetadata()

UpdateMetadata updates index metadata

type Metadata

type Metadata struct {
	Created int64 `json:"created"` // Index creation timestamp
	Size    int64 `json:"size"`    // Total data size
	Items   int   `json:"items"`   // Total number of items in repo
}

type VersionInfo

type VersionInfo struct {
	Variations []*VersionInfo `json:"variations,omitempty"` // Info about version variations (railsexpress version for example)
	Name       string         `json:"name"`                 // Version name
	File       string         `json:"file"`                 // Full filename (with extension)
	Path       string         `json:"path"`                 // Relative path to 7z file
	Hash       string         `json:"hash"`                 // SHA-256 hash
	Size       int64          `json:"size"`                 // Size in bytes
	Added      int64          `json:"added"`                // Timestamp with date when version was added to repo
	EOL        bool           `json:"eol"`                  // EOL marker
}

Jump to

Keyboard shortcuts

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