astore

package
v0.0.0-...-5f133c6 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: BSD-3-Clause Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IdAuto PathType = ""
	IdPath          = "path"
	IdUid           = "uid"
)

Variables

View Source
var UidRegex = regexp.MustCompile("^[a-z0-9]{32}$")

Functions

func CleanRemote

func CleanRemote(name string) (string, error)

func Download

func Download(ctx context.Context, f func(int64) io.WriteCloser, url string) error

func FindRemote

func FindRemote(name string, options SuggestOptions) (string, string, error)

func IsUid

func IsUid(path string) bool

func MacCpuString

func MacCpuString(cpu macho.Cpu) string

func SuggestGitName

func SuggestGitName(name string) (string, error)

func SuggestRemote

func SuggestRemote(name string, options SuggestOptions) (string, string, error)

func ToArchArray

func ToArchArray(archs []Arch) []string

func Upload

func Upload(ctx context.Context, r io.ReadCloser, size int64, url string) error

Types

type Arch

type Arch struct {
	Cpu string
	Os  string
}

func GuessArchOS

func GuessArchOS(name string) ([]Arch, error)

func GuessELF

func GuessELF(name string) ([]Arch, error)

func GuessMacDwarf

func GuessMacDwarf(name string) ([]Arch, error)

func GuessMacFat

func GuessMacFat(name string) ([]Arch, error)

func GuessPe

func GuessPe(name string) ([]Arch, error)

func (Arch) ToString

func (a Arch) ToString() string

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(conn grpc.ClientConnInterface) *Client

func NewNative

func NewNative(server string, mods ...grpc.DialOption) (*Client, error)

func NewWeb

func NewWeb(server string, mods ...gwc.Modifier) (*Client, error)

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, request *astore.DeleteRequest)

func (*Client) Download

func (c *Client) Download(files []FileToDownload, o DownloadOptions) ([]*apb.Artifact, error)

func (*Client) GetRetrieveResponse

func (c *Client) GetRetrieveResponse(name string, archs []string, defaultId PathType, tags *[]string) (*apb.RetrieveResponse, *apb.RetrieveRequest, PathType, error)

GetRetrieveResponse performs a Retrieve request, and returns both the generated request, and returned response.

func (*Client) List

func (c *Client) List(path string, o ListOptions) ([]*apb.Artifact, []*apb.Element, error)

func (*Client) Note

func (c *Client) Note(uid string, note string) ([]*astore.Artifact, error)

func (*Client) Publish

func (c *Client) Publish(el ToPublish) (string, *astore.ListResponse, error)

func (*Client) Tag

func (c *Client) Tag(uid string, mods ...TagModifier) ([]*astore.Artifact, error)

func (*Client) Unpublish

func (c *Client) Unpublish(el string) error

func (*Client) Upload

func (c *Client) Upload(files []FileToUpload, o UploadOptions) ([]*apb.Artifact, error)

type DownloadOptions

type DownloadOptions struct {
	*ccontext.Context
}

type FileToDownload

type FileToDownload struct {
	// Name of the file on the remote system.
	Remote     string   // ok
	RemoteType PathType // ok

	// How we want the file to be named on the local filesystem.
	Local string
	// Overwrite the file if there already?
	Overwrite bool
	// First architecture found is downloaded.
	Architecture []string // ok
	// No tags means latest tag.
	Tag *[]string
}

type FileToUpload

type FileToUpload struct {
	// Which file needs to be open on the local file system.
	Local string
	// How we want the file named on the remote file system.
	Remote string
	// If this file is geared toward a specific architecture.
	Architecture []string
	// User assigned note, nothing to see here, just a string.
	Note string
	// List of tags to apply to the file.
	Tag []string
}

type Formatter

type Formatter interface {
	Artifact(*astore.Artifact)
	Element(*astore.Element)
	Flush()
}

type ListOptions

type ListOptions struct {
	*ccontext.Context
	Tag []string
}

type PathType

type PathType string

func GetPathType

func GetPathType(name string, id PathType) PathType

func RetrieveRequestFromPath

func RetrieveRequestFromPath(name string, id PathType) (*apb.RetrieveRequest, PathType)

type SuggestOptions

type SuggestOptions struct {
	// If Directory is set, the returned remote location will use the set directory + the name of the file.
	Directory string
	File      string

	// Files specified to upload can be in the form /path/to/local@/path/to/remote/, which takes precedence
	// over any other recommendation mechanism.
	//
	// If DisableAt is set to true, this manual override is disabled.
	DisableAt bool
	// If DisableGit is set to true, git will not be used to suggest a remote file name.
	DisableGit bool

	// Allow absolute paths.
	AllowAbsolute bool
	// Allow a file name without directory.
	AllowSingleElement bool
}

type TagModifier

type TagModifier func(*astore.TagRequest)

func TagAdd

func TagAdd(set []string) TagModifier

func TagDel

func TagDel(set []string) TagModifier

func TagSet

func TagSet(set []string) TagModifier

type ToPublish

type ToPublish struct {
	// Public location where to publish the artifact.
	Public string

	// Path of the artifact
	Path string
	Uid  string
	Tag  *[]string

	// An architecture to bind this path to.
	// If empty, the client will be able to select the architecture.
	Architecture  string
	NonExistentOK bool
}

type UglyFormatter

type UglyFormatter os.File

func NewUgly

func NewUgly() *UglyFormatter

func (*UglyFormatter) Artifact

func (uf *UglyFormatter) Artifact(art *astore.Artifact)

func (*UglyFormatter) Element

func (uf *UglyFormatter) Element(el *astore.Element)

func (*UglyFormatter) File

func (uf *UglyFormatter) File() *os.File

func (*UglyFormatter) Flush

func (uf *UglyFormatter) Flush()

type UploadOptions

type UploadOptions struct {
	*ccontext.Context
}

Jump to

Keyboard shortcuts

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