contracts

package
v0.11.6 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RemoteManifestFilename = "manifest.json"
	RemoteArchiveFilename  = "archive"
)

Variables

View Source
var RetryErr = errors.New("retry")

Functions

func AppendRemotePath

func AppendRemotePath(prefix url.URL, packageName, version, fileName string) url.URL

func IsExecutable

func IsExecutable(mode os.FileMode) bool

Types

type Archive

type Archive struct {
	Filename             string        `json:"filename"`
	Size                 uint64        `json:"size"`
	MD5Checksum          []byte        `json:"md5"`
	Contents             []ArchiveItem `json:"contents"`
	CompressionAlgorithm string        `json:"compression"`
}

type ArchiveHeader

type ArchiveHeader struct {
	Name       string
	Size       int64
	ModTime    time.Time
	LinkName   string
	Executable bool
}

type ArchiveItem

type ArchiveItem struct {
	Path        string `json:"path"`
	Size        int64  `json:"size"`
	MD5Checksum []byte `json:"md5"`
}

type ArchiveWriter

type ArchiveWriter interface {
	Write([]byte) (int, error)
	Close() error
	WriteHeader(ArchiveHeader)
}

type Chmod

type Chmod interface {
	Chmod(name string, mode os.FileMode) error
}

type Deleter

type Deleter interface {
	Delete(path string)
}

type Dependency

type Dependency struct {
	PackageName    string `json:"package_name"`
	PackageVersion string `json:"package_version"`
	RemoteAddress  URL    `json:"remote_address"`
	LocalDirectory string `json:"local_directory"`
}

func (Dependency) ComposeLatestManifestRemoteAddress

func (this Dependency) ComposeLatestManifestRemoteAddress() url.URL

func (Dependency) ComposeRemoteAddress

func (this Dependency) ComposeRemoteAddress(fileName string) url.URL

func (Dependency) ComposeRemoteManifestAddress

func (this Dependency) ComposeRemoteManifestAddress() url.URL

func (Dependency) Title

func (this Dependency) Title() string

type DependencyListing

type DependencyListing struct {
	Credentials string       `json:"credentials"`
	Listing     []Dependency `json:"dependencies"`
}

func (*DependencyListing) Validate

func (this *DependencyListing) Validate() error

type Downloader

type Downloader interface {
	Download(url.URL) (io.ReadCloser, error)
}

type Environment

type Environment interface {
	LookupEnv(key string) (value string, set bool)
}

type FileChecker

type FileChecker interface {
	Stat(path string) (FileInfo, error)
}

type FileCreator

type FileCreator interface {
	Create(path string) io.WriteCloser
}

type FileInfo

type FileInfo interface {
	Path() string
	Size() int64
	ModTime() time.Time
	Symlink() string
	Mode() os.FileMode
}

type FileOpener

type FileOpener interface {
	Open(path string) io.ReadCloser
}

type FileReader

type FileReader interface {
	ReadFile(path string) ([]byte, error)
}

type FileWriter

type FileWriter interface {
	WriteFile(path string, content []byte)
}

type InstallationRequest

type InstallationRequest struct {
	RemoteAddress url.URL
	LocalPath     string
	PackageName   string
}

type IntegrityCheck

type IntegrityCheck interface {
	Verify(manifest Manifest, localPath string) error
}

type Manifest

type Manifest struct {
	Name    string  `json:"name"` //a-z 0-9 _-/
	Version string  `json:"version"`
	Archive Archive `json:"archive"`
}

type PackageConfig

type PackageConfig struct {
	CompressionAlgorithm string `json:"compression_algorithm"`
	CompressionLevel     int    `json:"compression_level"`
	SourceDirectory      string `json:"source_directory"`
	PackageName          string `json:"package_name"`
	PackageVersion       string `json:"package_version"`
	RemoteAddressPrefix  *URL   `json:"remote_address"`
}

func (PackageConfig) ComposeLatestManifestRemoteAddress

func (this PackageConfig) ComposeLatestManifestRemoteAddress() url.URL

func (PackageConfig) ComposeRemoteAddress

func (this PackageConfig) ComposeRemoteAddress(filename string) url.URL

type PackageInstaller

type PackageInstaller interface {
	DownloadManifest(remoteAddress url.URL) (manifest Manifest, err error)
	InstallManifest(request InstallationRequest) (manifest Manifest, err error)
	InstallPackage(manifest Manifest, request InstallationRequest) error
}

type PathLister

type PathLister interface {
	Listing() []FileInfo
}

type RemoteStorage

type RemoteStorage interface {
	Uploader
	Downloader
}

type RootPath

type RootPath interface {
	RootPath() string
}

type StatusCodeError

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

func NewStatusCodeError

func NewStatusCodeError(actual int, expected int, remoteAddress url.URL) *StatusCodeError

func (*StatusCodeError) Error

func (this *StatusCodeError) Error() string

func (*StatusCodeError) StatusCode

func (this *StatusCodeError) StatusCode() int

type SymlinkCreator

type SymlinkCreator interface {
	CreateSymlink(source, target string)
}

type URL

type URL url.URL

func (*URL) MarshalJSON

func (this *URL) MarshalJSON() ([]byte, error)

func (*URL) UnmarshalJSON

func (this *URL) UnmarshalJSON(p []byte) error

func (URL) Value

func (this URL) Value() *url.URL

type UploadConfig

type UploadConfig struct {
	MaxRetry          int
	GoogleCredentials gcs.Credentials
	JSONPath          string
	Overwrite         bool
	PackageConfig     PackageConfig
}

type UploadRequest

type UploadRequest struct {
	RemoteAddress url.URL
	Body          io.ReadSeeker
	Size          int64
	ContentType   string
	Checksum      []byte
}

type Uploader

type Uploader interface {
	Upload(UploadRequest) error
}

Jump to

Keyboard shortcuts

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