Documentation ¶
Index ¶
- Constants
- Variables
- func CheckLocalDns(resolvConf []byte) bool
- func CompareKernelVersion(a, b *KernelVersionInfo) int
- func CopyDirectory(source, dest string) error
- func CopyEscapable(dst io.Writer, src io.ReadCloser) (written int64, err error)
- func Debugf(format string, a ...interface{})
- func DisplayJSONMessagesStream(in io.Reader, out io.Writer) error
- func Download(url string, stderr io.Writer) (*http.Response, error)
- func FindCgroupMountpoint(cgroupType string) (string, error)
- func GetReleaseVersion() string
- func GetResolvConf() ([]byte, error)
- func GetTotalUsedFds() int
- func Go(f func() error) chan error
- func HashData(src io.Reader) (string, error)
- func HumanDuration(d time.Duration) string
- func HumanSize(size int64) string
- func IsGIT(str string) bool
- func IsURL(str string) bool
- func NewBufReader(r io.Reader) *bufReader
- func NewHTTPRequestError(msg string, res *http.Response) error
- func NopWriteCloser(w io.Writer) io.WriteCloser
- func ParseHost(host string, port int, addr string) string
- func ParseRepositoryTag(repos string) (string, string)
- func PartParser(template, data string) (map[string]string, error)
- func ProgressReader(r io.ReadCloser, size int, output io.Writer, tpl []byte, sf *StreamFormatter, ...) *progressReader
- func SelfPath() string
- func ShellQuoteArguments(args []string) string
- func StdCopy(dstout, dsterr io.Writer, src io.Reader) (written int64, err error)
- func StripComments(input []byte, commentMarker []byte) []byte
- func Trunc(s string, maxlen int) string
- func TruncateID(id string) string
- type DependencyGraph
- type DependencyNode
- type HTTPMetaHeadersDecorator
- type HTTPRequestDecorator
- type HTTPRequestFactory
- type HTTPUserAgentDecorator
- type JSONError
- type JSONLog
- type JSONMessage
- type KernelVersionInfo
- type NopFlusher
- type NopWriter
- type StatusError
- type StdType
- type StdWriter
- type StreamFormatter
- type StreamWriter
- type TarSum
- type TruncIndex
- type User
- type Utsname
- type VersionInfo
- type WriteBroadcaster
- type WriteFlusher
Constants ¶
const ( StdWriterPrefixLen = 8 StdWriterFdIndex = 0 StdWriterSizeIndex = 4 )
Variables ¶
var ErrInvalidStdHeader = errors.New("Unrecognized input header")
Functions ¶
func CheckLocalDns ¶ added in v0.4.1
CheckLocalDns looks into the /etc/resolv.conf, it returns true if there is a local nameserver or if there is no nameserver.
func CompareKernelVersion ¶
func CompareKernelVersion(a, b *KernelVersionInfo) int
Compare two KernelVersionInfo struct. Returns -1 if a < b, = if a == b, 1 it a > b
func CopyDirectory ¶ added in v0.3.4
FIXME: this is deprecated by CopyWithTar in archive.go
func CopyEscapable ¶
Code c/c from io.Copy() modified to handle escape sequence
func Debugf ¶
func Debugf(format string, a ...interface{})
Debug function, if the debug flag is set, then display. Do nothing otherwise If Docker is in damon mode, also send the debug info on the socket
func DisplayJSONMessagesStream ¶ added in v0.6.0
func FindCgroupMountpoint ¶
func GetReleaseVersion ¶ added in v0.6.0
func GetReleaseVersion() string
func GetResolvConf ¶ added in v0.6.0
GetResolvConf opens and read the content of /etc/resolv.conf. It returns it as byte slice.
func GetTotalUsedFds ¶
func GetTotalUsedFds() int
func Go ¶
Go is a basic promise implementation: it wraps calls a function in a goroutine, and returns a channel which will later return the function's return value.
func HumanDuration ¶
HumanDuration returns a human-readable approximation of a duration (eg. "About a minute", "4 hours ago", etc.)
func HumanSize ¶ added in v0.4.1
HumanSize returns a human-readable approximation of a size using SI standard (eg. "44kB", "17MB")
func NewBufReader ¶
func NewHTTPRequestError ¶ added in v0.6.0
func NopWriteCloser ¶
func NopWriteCloser(w io.Writer) io.WriteCloser
func ParseRepositoryTag ¶ added in v0.5.0
Get a repos name and returns the right reposName + tag The tag can be confusing because of a port in a repository name.
Ex: localhost.localdomain:5000/samalba/hipache:latest
func ProgressReader ¶
func ProgressReader(r io.ReadCloser, size int, output io.Writer, tpl []byte, sf *StreamFormatter, newline bool) *progressReader
func ShellQuoteArguments ¶ added in v0.6.7
func StdCopy ¶ added in v0.6.4
StdCopy is a modified version of io.Copy.
StdCopy copies from src to dstout or dsterr until either EOF is reached on src or an error occurs. It returns the number of bytes copied and the first error encountered while copying, if any.
A successful Copy returns err == nil, not err == EOF. Because Copy is defined to read from src until EOF, it does not treat an EOF from Read as an error to be reported.
The source needs to be writter via StdWriter, dstout or dsterr is selected based on the prefix added by StdWriter
func StripComments ¶ added in v0.6.2
StripComments parses input into lines and strips away comments.
func TruncateID ¶ added in v0.4.1
TruncateID returns a shorthand version of a string identifier for convenience. A collision with other shorthands is very unlikely, but possible. In case of a collision a lookup with TruncIndex.Get() will fail, and the caller will need to use a langer prefix, or the full-length Id.
Types ¶
type DependencyGraph ¶ added in v0.6.2
type DependencyGraph struct {
// contains filtered or unexported fields
}
func NewDependencyGraph ¶ added in v0.6.2
func NewDependencyGraph() DependencyGraph
func (*DependencyGraph) AddDependency ¶ added in v0.6.2
func (graph *DependencyGraph) AddDependency(node, to string) error
func (*DependencyGraph) GenerateTraversalMap ¶ added in v0.6.2
func (graph *DependencyGraph) GenerateTraversalMap() ([][]string, error)
The magic happens here ::
func (*DependencyGraph) NewNode ¶ added in v0.6.2
func (graph *DependencyGraph) NewNode(id string) string
type DependencyNode ¶ added in v0.6.2
type DependencyNode struct {
// contains filtered or unexported fields
}
func (*DependencyNode) Degree ¶ added in v0.6.2
func (node *DependencyNode) Degree() int
type HTTPMetaHeadersDecorator ¶ added in v0.6.1
func (*HTTPMetaHeadersDecorator) ChangeRequest ¶ added in v0.6.1
type HTTPRequestDecorator ¶ added in v0.6.0
type HTTPRequestDecorator interface { // ChangeRequest() changes the request accordingly. // The changed request will be returned or err will be non-nil // if an error occur. ChangeRequest(req *http.Request) (newReq *http.Request, err error) }
HTTPRequestDecorator is used to change an instance of http.Request. It could be used to add more header fields, change body, etc.
func NewHTTPUserAgentDecorator ¶ added in v0.6.0
func NewHTTPUserAgentDecorator(versions ...VersionInfo) HTTPRequestDecorator
type HTTPRequestFactory ¶ added in v0.6.0
type HTTPRequestFactory struct {
// contains filtered or unexported fields
}
HTTPRequestFactory creates an HTTP request and applies a list of decorators on the request.
func NewHTTPRequestFactory ¶ added in v0.6.0
func NewHTTPRequestFactory(d ...HTTPRequestDecorator) *HTTPRequestFactory
func (*HTTPRequestFactory) NewRequest ¶ added in v0.6.0
func (self *HTTPRequestFactory) NewRequest(method, urlStr string, body io.Reader, d ...HTTPRequestDecorator) (*http.Request, error)
NewRequest() creates a new *http.Request, applies all decorators in the HTTPRequestFactory on the request, then applies decorators provided by d on the request.
type HTTPUserAgentDecorator ¶ added in v0.6.0
type HTTPUserAgentDecorator struct {
// contains filtered or unexported fields
}
HTTPUserAgentDecorator appends the product/version to the user agent field of a request.
func (*HTTPUserAgentDecorator) ChangeRequest ¶ added in v0.6.0
type JSONError ¶ added in v0.6.0
type JSONMessage ¶ added in v0.4.1
type JSONMessage struct { Status string `json:"status,omitempty"` Progress string `json:"progress,omitempty"` ErrorMessage string `json:"error,omitempty"` //deprecated ID string `json:"id,omitempty"` From string `json:"from,omitempty"` Time int64 `json:"time,omitempty"` Error *JSONError `json:"errorDetail,omitempty"` }
type KernelVersionInfo ¶
func GetKernelVersion ¶
func GetKernelVersion() (*KernelVersionInfo, error)
func ParseRelease ¶ added in v0.6.2
func ParseRelease(release string) (*KernelVersionInfo, error)
func (*KernelVersionInfo) String ¶
func (k *KernelVersionInfo) String() string
type StatusError ¶ added in v0.6.2
type StatusError struct {
Status int
}
An StatusError reports an unsuccessful exit by a command.
func (*StatusError) Error ¶ added in v0.6.2
func (e *StatusError) Error() string
type StdType ¶ added in v0.6.4
type StdType [StdWriterPrefixLen]byte
type StdWriter ¶ added in v0.6.4
func NewStdWriter ¶ added in v0.6.4
NewStdWriter instanciate a new Writer based on the given type `t`. the utils package contains the valid parametres for `t`:
type StreamFormatter ¶ added in v0.4.0
type StreamFormatter struct {
// contains filtered or unexported fields
}
func NewStreamFormatter ¶ added in v0.4.0
func NewStreamFormatter(json bool) *StreamFormatter
func (*StreamFormatter) FormatError ¶ added in v0.4.0
func (sf *StreamFormatter) FormatError(err error) []byte
func (*StreamFormatter) FormatProgress ¶ added in v0.4.0
func (sf *StreamFormatter) FormatProgress(id, action, progress string) []byte
func (*StreamFormatter) FormatStatus ¶ added in v0.4.0
func (sf *StreamFormatter) FormatStatus(id, format string, a ...interface{}) []byte
func (*StreamFormatter) Used ¶ added in v0.4.0
func (sf *StreamFormatter) Used() bool
type StreamWriter ¶ added in v0.5.1
type StreamWriter struct {
// contains filtered or unexported fields
}
type TruncIndex ¶
type TruncIndex struct {
// contains filtered or unexported fields
}
TruncIndex allows the retrieval of string identifiers by any of their unique prefixes. This is used to retrieve image and container IDs by more convenient shorthand prefixes.
func NewTruncIndex ¶
func NewTruncIndex() *TruncIndex
func (*TruncIndex) Add ¶
func (idx *TruncIndex) Add(id string) error
func (*TruncIndex) Delete ¶
func (idx *TruncIndex) Delete(id string) error
type User ¶ added in v0.6.2
type User struct { Uid string // user id Gid string // primary group id Username string Name string HomeDir string }
func UserLookup ¶ added in v0.5.0
UserLookup check if the given username or uid is present in /etc/passwd and returns the user struct. If the username is not found, an error is returned.
type VersionInfo ¶ added in v0.6.0
VersionInfo is used to model entities which has a version. It is basically a tupple with name and version.
type WriteBroadcaster ¶
func NewWriteBroadcaster ¶
func NewWriteBroadcaster() *WriteBroadcaster
func (*WriteBroadcaster) AddWriter ¶
func (w *WriteBroadcaster) AddWriter(writer io.WriteCloser, stream string)
func (*WriteBroadcaster) CloseWriters ¶
func (w *WriteBroadcaster) CloseWriters() error
type WriteFlusher ¶
func NewWriteFlusher ¶
func NewWriteFlusher(w io.Writer) *WriteFlusher