Documentation ¶
Index ¶
- Constants
- func DisplayRatio(current uint64, total uint64, opts ...DisplayOptions) string
- func FormatBytes(bytes uint64) string
- func Shorten(s string, truncateLen int) string
- type CgroupStatsCollection
- type CgroupStatsProvider
- type Collection
- type CommonCgroupStatsProvider
- type CsvOutput
- type DisplayOptions
- type DisplayOutput
Constants ¶
View Source
const ( DividerText = "[...]" DiverTextLen = len(DividerText) )
Variables ¶
This section is empty.
Functions ¶
func DisplayRatio ¶
func DisplayRatio(current uint64, total uint64, opts ...DisplayOptions) string
func FormatBytes ¶
Types ¶
type CgroupStatsCollection ¶
type CgroupStatsCollection interface { // ToCsvOutput will transform the underlying collection into a format which can be written to a CSV file. ToCsvOutput() *CsvOutput // ToDisplayOutput will transform the underlying collection into a format which can be displayed to the screen. ToDisplayOutput() *DisplayOutput // ToVerboseOutput will transform the write the given collection to the provided writer. There is no guarantee about // the format of the data that is written to the given writer. ToVerboseOutput(writer io.Writer) }
type CgroupStatsProvider ¶
type CgroupStatsProvider interface { // ListCgroupsByPrefix will return a list of cgroup names that start with the given prefix. ListCgroupsByPrefix(cgroupPrefix string) []string // GetCgroupStatsByPrefix will return stats for cgroups that start with the given prefix. GetCgroupStatsByPrefix(prefix string) (CgroupStatsCollection, error) // GetCgroupStatsByName will return stats for the cgroup that matches the given name. GetCgroupStatsByName(name string) (CgroupStatsCollection, error) }
type Collection ¶
type Collection[T any] struct { Stats []T CsvHeadersProvider func() []string CsvRowTransformer func(T) []string DisplayHeadersProvider func() []interface{} DisplayRowTransformer func(T) []interface{} VerboseOutputTransformer func(io.Writer, []T) }
func (Collection[T]) ToCsvOutput ¶
func (c Collection[T]) ToCsvOutput() *CsvOutput
func (Collection[T]) ToDisplayOutput ¶
func (c Collection[T]) ToDisplayOutput() *DisplayOutput
func (Collection[T]) ToVerboseOutput ¶
func (c Collection[T]) ToVerboseOutput(w io.Writer)
type CommonCgroupStatsProvider ¶
type CommonCgroupStatsProvider struct {
// contains filtered or unexported fields
}
func NewCommonCgroupStatsProvider ¶
func NewCommonCgroupStatsProvider(rootDir string) *CommonCgroupStatsProvider
func (*CommonCgroupStatsProvider) ListCgroupsByPrefix ¶
func (c *CommonCgroupStatsProvider) ListCgroupsByPrefix(cgroupPrefix string) []string
type DisplayOptions ¶
type DisplayOptions func(d *displayOptions)
func WithBytes ¶
func WithBytes() DisplayOptions
func WithTotal ¶
func WithTotal() DisplayOptions
type DisplayOutput ¶
type DisplayOutput struct { Headers []interface{} Rows [][]interface{} }
Click to show internal directories.
Click to hide internal directories.