qiniu

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2020 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// ArtifactsDirName is the name of directory defined in prow to store test artifacts
	ArtifactsDirName = "artifacts"

	//default prow coverage file
	PostSubmitCoverProfile = "filtered.cov"

	//default to save changed file related coverage profile
	ChangedProfileName = "changed-file-profile.cov"
)

Variables

This section is empty.

Functions

func FindBaseProfileFromQiniu

func FindBaseProfileFromQiniu(qc *Client, prowJobName, covProfileName string) ([]byte, error)

FindBaseProfileFromQiniu finds the coverage profile file from the latest healthy build stored in given gcs directory

func MockRouterAPI

func MockRouterAPI(router *httprouter.Router, profile string)

Types

type Artifacts

type Artifacts struct {
	Directory          string
	ProfileName        string
	ChangedProfileName string // create temporary to save changed file related coverage profile
}

func (*Artifacts) CreateChangedProfile

func (a *Artifacts) CreateChangedProfile() *os.File

func (*Artifacts) ProfilePath

func (a *Artifacts) ProfilePath() string

type Client

type Client struct {
	BucketManager *storage.BucketManager
	// contains filtered or unexported fields
}

Client for the operation with qiniu cloud

func MockQiniuServer

func MockQiniuServer(config *Config) (client *Client, router *httprouter.Router, serverURL string, teardown func())

func NewClient

func NewClient(cfg *Config) *Client

NewClient creates a new client to work with qiniu cloud

func (*Client) GetAccessURL

func (q *Client) GetAccessURL(key string, timeout time.Duration) string

GetAccessURL return a url which can access artifact directly in qiniu

func (*Client) GetArtifactDetails

func (q *Client) GetArtifactDetails(key string) (*LogHistoryTemplate, error)

Artifacts lists all artifacts available for the given job source

func (*Client) ListAll

func (q *Client) ListAll(ctx context.Context, prefix string, delimiter string) ([]string, error)

ListAll to list all the files with contains the expected prefix

func (*Client) ListSubDirs

func (q *Client) ListSubDirs(prefix string) ([]string, error)

func (*Client) QiniuObjectHandle

func (q *Client) QiniuObjectHandle(key string) *ObjectHandle

QiniuObjectHandle construct a object hanle to access file in qiniu

func (*Client) ReadObject

func (q *Client) ReadObject(key string) ([]byte, error)

ReadObject to read all the content of key

type Config

type Config struct {
	Bucket    string `json:"bucket"`
	AccessKey string `json:"accessKey"`
	SecretKey string `json:"secretKey"`

	// domain used to download files from qiniu cloud
	Domain string `json:"domain"`
}

Config store the credentials to connect with qiniu cloud

type LogHistoryTemplate

type LogHistoryTemplate struct {
	BucketName string
	KeyPath    string
	Items      []logHistoryItem
}

type ObjectHandle

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

ObjectHandle provides operations on an object in a qiniu cloud bucket

func (*ObjectHandle) Attrs

func (o *ObjectHandle) Attrs(ctx context.Context) (storage.FileInfo, error)

func (*ObjectHandle) NewRangeReader

func (o *ObjectHandle) NewRangeReader(ctx context.Context, offset, length int64) (io.ReadCloser, error)

NewRangeReader reads parts of an object, reading at most length bytes starting from the given offset. If length is negative, the object is read until the end.

func (*ObjectHandle) NewReader

func (o *ObjectHandle) NewReader(ctx context.Context) (io.ReadCloser, error)

NewReader creates a reader to read the contents of the object. ErrObjectNotExist will be returned if the object is not found. The caller must call Close on the returned Reader when done reading.

Jump to

Keyboard shortcuts

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