download

package
v0.0.0-...-f9c6b4f Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ServerURLMissingError = fmt.Errorf("Unable to find download URL for the server in the json feed")
)

Functions

This section is empty.

Types

type JSONFeed

type JSONFeed struct {
	Versions []*ToolsVersion `json:"versions"`
}

JSONFeed represents the structure of the JSON document consumed by the MongoDB downloads center. An abbreviated version of the document might look like:

{
  "versions": [
    {
      "version": "4.3.2",
      "downloads": [
        {
          "name": "amazon",
          "arch": "x86_64",
          "archive": {
            "url": "fastdl.mongodb.org/tools/db/...tgz",
            "md5": "4ec7...",
            "sha1": "3269...",
            "sha256": "0b679..."
          },
          "package": {
            "url": "fastdl.mongodb.org/tools/db/...rpm",
            "md5": "5b35...",
            "sha1": "b07c...",
            "sha256": "f6e7..."
          }
        },
        ...
      ]
    }
  ]
}

func (*JSONFeed) FindOrCreateDownload

func (f *JSONFeed) FindOrCreateDownload(version, platform, arch string) *ToolsDownload

FindOrCreateDownload will find the ToolsDownload in f that matches the version, platform, and arch. If the ToolsDownload does not exist, it will be added to f. If the parent ToolsVersion doesn't exist either, that will also be created.

func (*JSONFeed) Sort

func (f *JSONFeed) Sort()

Sort will sort f.Versions by semver version. Version preference for the suffix of pre-release versions are alphabetical. Within each version, Downloads are sorted by OS name and architecture.

type ServerArchive

type ServerArchive struct {
	URL string `json:"url"`
}

type ServerDownload

type ServerDownload struct {
	Target  string        `json:"target"`
	Edition string        `json:"edition"`
	Arch    string        `json:"arch"`
	Archive ServerArchive `json:"archive"`
}

type ServerJSONFeed

type ServerJSONFeed struct {
	Versions []*ServerVersion `json:"versions"`
}

JSONFeed represents the structure of the JSON document consumed by the MongoDB downloads center.

func (*ServerJSONFeed) FindURLHashAndVersion

func (f *ServerJSONFeed) FindURLHashAndVersion(serverVersion string, target string, arch string, edition string) (string, string, string, error)

type ServerVersion

type ServerVersion struct {
	Version   string            `json:"version"`
	Downloads []*ServerDownload `json:"downloads"`
	GitHash   string            `json:"githash"`
}

type ToolsArchive

type ToolsArchive ToolsArtifact

type ToolsArtifact

type ToolsArtifact struct {
	URL    string `json:"url"`
	Md5    string `json:"md5"`
	Sha1   string `json:"sha1"`
	Sha256 string `json:"sha256"`
}

type ToolsDownload

type ToolsDownload struct {
	Name    string        `json:"name"`
	Arch    string        `json:"arch"`
	Archive ToolsArchive  `json:"archive"`
	Package *ToolsPackage `json:"package,omitempty"`
}

type ToolsPackage

type ToolsPackage ToolsArtifact

type ToolsVersion

type ToolsVersion struct {
	Version   string           `json:"version"`
	Downloads []*ToolsDownload `json:"downloads"`
}

Jump to

Keyboard shortcuts

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