bitsmanager

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2018 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CHUNK_FOR_SHA1 = 5 * 1024
	APP_FILENAME   = "application.zip"
)
View Source
const (
	DefaultAppUploadBitsTimeout = 15 * time.Minute
)

Variables

View Source
var GZIP_FILE_EXT []string = []string{
	".gz",
	".gzip",
}
View Source
var TARGZ_FILE_EXT []string = []string{
	".tgz",
}
View Source
var TAR_FILE_EXT []string = []string{
	".tar",
}
View Source
var ZIP_FILE_EXT []string = []string{
	".zip",
	".jar",
	".war",
}

Functions

func GetSha1FromReader

func GetSha1FromReader(reader io.ReadCloser) (string, error)

func HasExtFile added in v0.9.0

func HasExtFile(path string, extensions ...string) bool

func IsTarFile added in v0.9.0

func IsTarFile(path string) bool

func IsTarGzFile added in v0.9.0

func IsTarGzFile(path string) bool

func IsZipFile

func IsZipFile(path string) bool

Types

type ApplicationBitsRepository

type ApplicationBitsRepository interface {
	GetApplicationSha1(appGUID string) (string, error)
	IsDiff(appGUID string, currentSha1 string) (bool, string, error)
	UploadBits(appGUID string, zipFile io.ReadCloser, fileSize int64) (apiErr error)
	CopyBits(origAppGuid string, newAppGuid string) error
}

type BitsManager

type BitsManager interface {
	Upload(appGuid string, path string) error
	CopyBits(origAppGuid string, newAppGuid string) error
	GetSha1(path string) (sha1 string, err error)
	IsDiff(path string, currentSha1 string) (isDiff bool, sha1 string, err error)
}

type CloudControllerApplicationBitsRepository

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

func NewCloudControllerApplicationBitsRepository

func NewCloudControllerApplicationBitsRepository(config coreconfig.Reader, gateway net.Gateway) (repo CloudControllerApplicationBitsRepository)

func (CloudControllerApplicationBitsRepository) CopyBits

func (repo CloudControllerApplicationBitsRepository) CopyBits(origAppGuid string, newAppGuid string) error

func (CloudControllerApplicationBitsRepository) GetApplicationSha1

func (repo CloudControllerApplicationBitsRepository) GetApplicationSha1(appGUID string) (string, error)

func (CloudControllerApplicationBitsRepository) IsDiff

func (repo CloudControllerApplicationBitsRepository) IsDiff(appGUID string, currentSha1 string) (bool, string, error)

func (CloudControllerApplicationBitsRepository) UploadBits

func (repo CloudControllerApplicationBitsRepository) UploadBits(appGUID string, zipFile io.ReadCloser, fileSize int64) error

func (CloudControllerApplicationBitsRepository) UploadBitsTmp

func (repo CloudControllerApplicationBitsRepository) UploadBitsTmp(appGUID string, zipFile io.ReadCloser, fileSize int64) (apiErr error)

/// Old way to send bits, now do it as a stream

type CloudControllerBitsManager

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

func NewCloudControllerBitsManager

func NewCloudControllerBitsManager(appBitsRepo ApplicationBitsRepository, handlers []Handler) (manager CloudControllerBitsManager)

func (CloudControllerBitsManager) CopyBits

func (m CloudControllerBitsManager) CopyBits(origAppGuid string, newAppGuid string) error

func (CloudControllerBitsManager) GetSha1

func (m CloudControllerBitsManager) GetSha1(path string) (string, error)

func (CloudControllerBitsManager) IsDiff

func (m CloudControllerBitsManager) IsDiff(path string, currentSha1 string) (bool, string, error)

func (CloudControllerBitsManager) Upload

func (m CloudControllerBitsManager) Upload(appGuid string, path string) error

type FileHandler

type FileHandler struct {
	ZipFile io.ReadCloser
	Size    int64
	Clean   func() error
}

type GitHandler added in v0.9.0

type GitHandler struct {
}

func NewGitHandler added in v0.9.0

func NewGitHandler(skipInsecureSSL bool) *GitHandler

func (GitHandler) Detect added in v0.9.0

func (h GitHandler) Detect(path string) bool

func (GitHandler) GetSha1File added in v0.9.0

func (h GitHandler) GetSha1File(path string) (string, error)

func (GitHandler) GetZipFile added in v0.9.0

func (h GitHandler) GetZipFile(path string) (FileHandler, error)

type GitUtils added in v0.9.0

type GitUtils struct {
	Folder     string
	Url        string
	RefName    string
	AuthMethod transport.AuthMethod
}

func (GitUtils) Clone added in v0.9.0

func (g GitUtils) Clone() error

func (GitUtils) GetCommitSha1 added in v0.9.0

func (g GitUtils) GetCommitSha1() (string, error)

type Handler

type Handler interface {
	GetZipFile(path string) (fileHandler FileHandler, err error)
	GetSha1File(path string) (sha1 string, err error)
	Detect(path string) bool
}

type HttpHandler

type HttpHandler struct {
	SkipInsecureSSL bool
}

func NewHttpHandler added in v0.9.0

func NewHttpHandler(skipInsecureSSL bool) *HttpHandler

func (HttpHandler) Detect

func (h HttpHandler) Detect(path string) bool

func (HttpHandler) GetSha1File

func (h HttpHandler) GetSha1File(path string) (string, error)

func (HttpHandler) GetZipFile

func (h HttpHandler) GetZipFile(path string) (FileHandler, error)

type Job

type Job struct {
	Metadata struct {
		GUID      string    `json:"guid"`
		CreatedAt time.Time `json:"created_at"`
		URL       string    `json:"url"`
	} `json:"metadata"`
	Entity struct {
		GUID         string `json:"guid"`
		Status       string `json:"status"`
		Error        string `json:"error"`
		ErrorDetails struct {
			Code        int    `json:"code"`
			Description string `json:"description"`
			ErrorCode   string `json:"error_code"`
		} `json:"error_details"`
	} `json:"entity"`
}

type LocalHandler

type LocalHandler struct {
}

func NewLocalHandler added in v0.9.0

func NewLocalHandler() *LocalHandler

func (LocalHandler) Detect

func (h LocalHandler) Detect(path string) bool

func (LocalHandler) GetSha1File

func (h LocalHandler) GetSha1File(path string) (string, error)

func (LocalHandler) GetZipFile

func (h LocalHandler) GetZipFile(path string) (FileHandler, error)

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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