common

package
v0.0.0-...-c28e036 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildTaskRespMsg

func BuildTaskRespMsg(taskReqMsg *taskpb.TaskReqMsg, respSpec *taskpb.Spec, log *taskpb.Log, err error) *taskpb.TaskRespMsg

BuildTaskRespMsg constructs and returns a taskResMsg from the params;

taskReqMsg is the taskpb.TaskReqMsg that the task was originally called with
respSpec is the taskpb.Spec the updated task spec as a result of this task request
lf are the logFields for this task
err defines whether the taskProgressMsg's Status is SUCCESS or FAILURE

func CountLines

func CountLines(s string) int64

func CreateTmpDir

func CreateTmpDir(dir, prefix string) string

CreateTmpDir creates a new temporary directory in the directory dir with a name beginning with prefix and returns the path of the new directory. If dir is the empty string, CreateTmpDir uses the default directory for temporary files (see os.TempDir).

func CreateTmpFile

func CreateTmpFile(dir, filePrefix, content string) string

CreateTmpFile creates a new temporary file in the directory dir with a name beginning with prefix, and a content string. If dir is the empty string, CreateTmpFile uses the default directory for temporary files (see os.TempDir). This method will return the path of the created file. It will panic in case of failure creating or writing to the file.

func GetFailureTypeFromError

func GetFailureTypeFromError(err error) taskpb.FailureType

GetFailureTypeFromError attempts to identify the passed in error and returns a taskpb.FailureType.

func GetGCSGenerationNumCondition

func GetGCSGenerationNumCondition(generationNum int64) storage.Conditions

func IsValidFailureMsg

func IsValidFailureMsg(taskRelRsrcName string, failureType taskpb.FailureType, taskRespMsg *taskpb.TaskRespMsg) (bool, string)

func IsValidSuccessMsg

func IsValidSuccessMsg(taskRelRsrcName string, taskRespMsg *taskpb.TaskRespMsg) (bool, string)

func NewStringReadCloser

func NewStringReadCloser(s string) *stringReadCloser

Types

type AgentError

type AgentError struct {
	Msg         string
	FailureType taskpb.FailureType
}

func (AgentError) Error

func (ae AgentError) Error() string

type StringWriteCloser

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

StringWriteCloser implements WriteCloser interface for faking storage.Writer.

func NewStringWriteCloser

func NewStringWriteCloser(attrs *storage.ObjectAttrs) *StringWriteCloser

func (*StringWriteCloser) Attrs

func (*StringWriteCloser) Close

func (m *StringWriteCloser) Close() error

func (*StringWriteCloser) CloseWithError

func (m *StringWriteCloser) CloseWithError(err error) error

func (*StringWriteCloser) NumberLines

func (m *StringWriteCloser) NumberLines() int64

func (*StringWriteCloser) Write

func (m *StringWriteCloser) Write(p []byte) (int, error)

func (*StringWriteCloser) WrittenString

func (m *StringWriteCloser) WrittenString() string

Jump to

Keyboard shortcuts

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