backends

package
v0.0.0-...-6801fd0 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	URLPrefixHTTP  = "http://"
	URLPrefixHTTPS = "https://"
)
View Source
const URLPrefixFilesystem = "file://"
View Source
const URLPrefixGit = "git+"
View Source
const URLPrefixS3 = "s3://"

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	URLPrefix() string
	CopyObject(srcURL, destURL string) error
	Prefixes() []string
	PathExists(string) (bool, error)
	GetObjectHash(string) (map[string]string, error)
}

type Filesystem

type Filesystem struct{}

func NewFilesystemWithOptions

func NewFilesystemWithOptions(opts *Options) *Filesystem

func (*Filesystem) CopyObject

func (fsb *Filesystem) CopyObject(srcURL, destURL string) error

func (*Filesystem) GetObjectHash

func (fsb *Filesystem) GetObjectHash(objectURL string) (hashes map[string]string, err error)

GetObjectHash returns the hashes of the specified file

func (*Filesystem) PathExists

func (fsb *Filesystem) PathExists(path string) (bool, error)

func (*Filesystem) Prefixes

func (fsb *Filesystem) Prefixes() []string

func (*Filesystem) URLPrefix

func (fsb *Filesystem) URLPrefix() string

type ObjectBackendGit

type ObjectBackendGit struct{}

func NewGitWithOptions

func NewGitWithOptions(opts *Options) *ObjectBackendGit

func (*ObjectBackendGit) CopyObject

func (g *ObjectBackendGit) CopyObject(srcURL, destURL string) error

func (*ObjectBackendGit) GetObjectHash

func (g *ObjectBackendGit) GetObjectHash(objectURL string) (hashes map[string]string, err error)

GetObjectHash returns the hash of an object. In the case of data stored in a git repo, all artifacts return the hash of the repo commit

func (*ObjectBackendGit) PathExists

func (g *ObjectBackendGit) PathExists(nodeURL string) (bool, error)

PathExists checks if a path exosts in the filesystem

func (*ObjectBackendGit) Prefixes

func (g *ObjectBackendGit) Prefixes() []string

func (*ObjectBackendGit) URLPrefix

func (g *ObjectBackendGit) URLPrefix() string

type ObjectBackendHTTP

type ObjectBackendHTTP struct{}

func NewHTTPWithOptions

func NewHTTPWithOptions(opts *Options) *ObjectBackendHTTP

func (*ObjectBackendHTTP) CopyObject

func (h *ObjectBackendHTTP) CopyObject(srcURL, destURL string) (err error)

func (*ObjectBackendHTTP) GetObjectHash

func (h *ObjectBackendHTTP) GetObjectHash(objectURL string) (hashes map[string]string, err error)

func (*ObjectBackendHTTP) PathExists

func (h *ObjectBackendHTTP) PathExists(objectURL string) (bool, error)

func (*ObjectBackendHTTP) Prefixes

func (h *ObjectBackendHTTP) Prefixes() []string

func (*ObjectBackendHTTP) URLPrefix

func (h *ObjectBackendHTTP) URLPrefix() string

type ObjectBackendS3

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

func NewS3WithOptions

func NewS3WithOptions(opts *Options) *ObjectBackendS3

func (*ObjectBackendS3) CopyObject

func (s3 *ObjectBackendS3) CopyObject(srcURL, destURL string) error

func (*ObjectBackendS3) GetObjectHash

func (s3 *ObjectBackendS3) GetObjectHash(objectURL string) (hashes map[string]string, err error)

GetObjectHash returns a hash of a remote object. In S3, there are no APIs to get the file hash so we have to download and sum.

func (*ObjectBackendS3) PathExists

func (s3 *ObjectBackendS3) PathExists(nodeURL string) (bool, error)

PathExists checks if a path exosts in the filesystem

func (*ObjectBackendS3) Prefixes

func (s3 *ObjectBackendS3) Prefixes() []string

func (*ObjectBackendS3) URLPrefix

func (s3 *ObjectBackendS3) URLPrefix() string

type Options

type Options struct {
	ServiceOptions interface{}
}

Jump to

Keyboard shortcuts

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