client

package
v0.0.0-...-a420e69 Latest Latest
Warning

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

Go to latest
Published: May 24, 2016 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const DefaultReqTimeout = 30 * time.Second

Default timeout for any HTTP requests. On timeout, mark the operation as failed, but retriable.

View Source
const MAX_PENDING_REPORTS = 100

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact

type Artifact interface {
	// Returns a read-only copy of the raw model.Artifact instance associated with the artifact
	GetArtifactModel() *model.Artifact

	// Returns a handle to the bucket containing the artifact
	GetBucket() *Bucket

	// Return raw contents of the artifact (artifact file or text of a log stream)
	// as an io.ReadCloser. It is the responsibility of the caller to close the
	// io.ReadCloser
	GetContent() (io.ReadCloser, *ArtifactsError)

	// Returns a direct link to the raw contents of this artifact
	GetContentURL() string
}

type ArtifactImpl

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

func (*ArtifactImpl) GetArtifactModel

func (ai *ArtifactImpl) GetArtifactModel() *model.Artifact

func (*ArtifactImpl) GetBucket

func (ai *ArtifactImpl) GetBucket() *Bucket

func (ArtifactImpl) GetContent

func (a ArtifactImpl) GetContent() (io.ReadCloser, *ArtifactsError)

func (*ArtifactImpl) GetContentURL

func (ai *ArtifactImpl) GetContentURL() string

GetContentURL returns a direct link to the raw contents of an artifact

type ArtifactStoreClient

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

func NewArtifactStoreClient

func NewArtifactStoreClient(serverURL string) *ArtifactStoreClient

func NewArtifactStoreClientWithContext

func NewArtifactStoreClientWithContext(serverURL string, timeout time.Duration, ctx context.Context) *ArtifactStoreClient

NewArtifactStoreClientWithContext creates a new client with given context and per-request timeout.

func (*ArtifactStoreClient) GetBucket

func (c *ArtifactStoreClient) GetBucket(bucketName string) (*Bucket, *ArtifactsError)

func (*ArtifactStoreClient) NewBucket

func (c *ArtifactStoreClient) NewBucket(bucketName string, owner string, deadlineMins int) (*Bucket, *ArtifactsError)

XXX deadlineMins is not used. Is this planned for something?

type ArtifactsError

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

func NewRetriableError

func NewRetriableError(errStr string) *ArtifactsError

func NewRetriableErrorf

func NewRetriableErrorf(format string, args ...interface{}) *ArtifactsError

func NewTerminalError

func NewTerminalError(errStr string) *ArtifactsError

func NewTerminalErrorf

func NewTerminalErrorf(format string, args ...interface{}) *ArtifactsError

func (*ArtifactsError) Error

func (e *ArtifactsError) Error() string

func (*ArtifactsError) IsRetriable

func (e *ArtifactsError) IsRetriable() bool

type Bucket

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

func (*Bucket) Close

func (b *Bucket) Close() *ArtifactsError

func (*Bucket) GetArtifact

func (b *Bucket) GetArtifact(name string) (Artifact, *ArtifactsError)

func (*Bucket) ListArtifacts

func (b *Bucket) ListArtifacts() ([]Artifact, *ArtifactsError)

func (*Bucket) NewChunkedArtifact

func (b *Bucket) NewChunkedArtifact(name string) (*ChunkedArtifact, *ArtifactsError)

Creates a new chunked artifact whose size does not have to be known. The name acts as an id for the artifact. Because of additional overhead if the size is already known then `NewStreamedArtifact` may be more applicable.

func (*Bucket) NewStreamedArtifact

func (b *Bucket) NewStreamedArtifact(path string, size int64) (*StreamedArtifact, *ArtifactsError)

NewStreamedArtifact creates a new streamed (fixed-size) artifact given a file path and size. The artifact name (which serves as its id) is computed from the file name (this is a hint to the server which is free to modify the artifact name).

The artifact does not actually get uploaded here - that will need to be perfomeed in UploadArtifact. The artifact will only be complete when the server has received exactly "size" bytes. This is only suitable for static content such as files.

type ChunkedArtifact

type ChunkedArtifact struct {
	*ArtifactImpl
	// contains filtered or unexported fields
}

A chunked artifact is one which can be sent in chunks of varying size. It is only complete upon the client manually telling the server that it is complete, and is useful for logs and other other artifacts whose size is not known at the same they are streaming.

func (*ChunkedArtifact) AppendLog

func (artifact *ChunkedArtifact) AppendLog(chunk string) *ArtifactsError

Appends the log chunk to the stream. This is asynchronous so any errors in sending will occur when closing the artifact.

func (*ChunkedArtifact) Close

func (a *ChunkedArtifact) Close() *ArtifactsError

func (*ChunkedArtifact) Flush

func (artifact *ChunkedArtifact) Flush() *ArtifactsError

type StreamedArtifact

type StreamedArtifact struct {
	*ArtifactImpl
}

A streamed artifact is a fixed-size artifact whose size is known at the start of the transfer. It is therefore not suitable for logs but useful for static files, etc.

func (*StreamedArtifact) UploadArtifact

func (a *StreamedArtifact) UploadArtifact(stream io.Reader) *ArtifactsError

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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