formatter

package
v1.4.2-0...-da2159e Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2016 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TableFormatKey  = "table"
	RawFormatKey    = "raw"
	PrettyFormatKey = "pretty"
)

Format keys used to specify certain kinds of output formats

Variables

This section is empty.

Functions

func ContainerStatsWrite

func ContainerStatsWrite(ctx Context, containerStats []*ContainerStats) error

ContainerStatsWrite renders the context for a list of containers statistics

func ContainerWrite

func ContainerWrite(ctx Context, containers []types.Container) error

ContainerWrite renders the context for a list of containers

func ImageWrite

func ImageWrite(ctx ImageContext, images []types.Image) error

ImageWrite writes the formatter images using the ImageContext

func NetworkWrite

func NetworkWrite(ctx Context, networks []types.NetworkResource) error

NetworkWrite writes the context

func ServiceInspectWrite

func ServiceInspectWrite(ctx Context, refs []string, getRef inspect.GetRefFunc) error

ServiceInspectWrite renders the context for a list of services

func VolumeWrite

func VolumeWrite(ctx Context, volumes []*types.Volume) error

VolumeWrite writes formatted volumes using the Context

Types

type ContainerStats

type ContainerStats struct {
	Mu sync.RWMutex
	ContainerStatsAttrs
	Err error
}

ContainerStats represents the containers statistics data.

func NewContainerStats

func NewContainerStats(name, osType string) *ContainerStats

NewContainerStats returns a new ContainerStats entity and sets in it the given name

type ContainerStatsAttrs

type ContainerStatsAttrs struct {
	Windows          bool
	Name             string
	CPUPercentage    float64
	Memory           float64 // On Windows this is the private working set
	MemoryLimit      float64 // Not used on Windows
	MemoryPercentage float64 // Not used on Windows
	NetworkRx        float64
	NetworkTx        float64
	BlockRead        float64
	BlockWrite       float64
	PidsCurrent      uint64 // Not used on Windows
}

ContainerStatsAttrs represents the statistics data collected from a container.

type Context

type Context struct {
	// Output is the output stream to which the formatted string is written.
	Output io.Writer
	// Format is used to choose raw, table or custom format for the output.
	Format Format
	// Trunc when set to true will truncate the output of certain fields such as Container ID.
	Trunc bool
	// contains filtered or unexported fields
}

Context contains information required by the formatter to print the output as desired.

func (*Context) Write

func (c *Context) Write(sub subContext, f SubFormat) error

Write the template to the buffer using this Context

type Format

type Format string

Format is the format string rendered using the Context

func NewContainerFormat

func NewContainerFormat(source string, quiet bool, size bool) Format

NewContainerFormat returns a Format for rendering using a Context

func NewImageFormat

func NewImageFormat(source string, quiet bool, digest bool) Format

NewImageFormat returns a format for rendering an ImageContext

func NewNetworkFormat

func NewNetworkFormat(source string, quiet bool) Format

NewNetworkFormat returns a Format for rendering using a network Context

func NewServiceFormat

func NewServiceFormat(source string) Format

NewServiceFormat returns a Format for rendering using a Context

func NewStatsFormat

func NewStatsFormat(source, osType string) Format

NewStatsFormat returns a format for rendering an CStatsContext

func NewVolumeFormat

func NewVolumeFormat(source string, quiet bool) Format

NewVolumeFormat returns a format for use with a volume Context

func (Format) Contains

func (f Format) Contains(sub string) bool

Contains returns true if the format contains the substring

func (Format) IsTable

func (f Format) IsTable() bool

IsTable returns true if the format is a table-type format

type HeaderContext

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

HeaderContext provides the subContext interface for managing headers

func (*HeaderContext) AddHeader

func (c *HeaderContext) AddHeader(header string)

AddHeader adds another column to the header

func (*HeaderContext) FullHeader

func (c *HeaderContext) FullHeader() string

FullHeader returns the header as a string

type ImageContext

type ImageContext struct {
	Context
	Digest bool
}

ImageContext contains image specific information required by the formater, encapsulate a Context struct.

type SubFormat

type SubFormat func(func(subContext) error) error

SubFormat is a function type accepted by Write()

Jump to

Keyboard shortcuts

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