fs

package
v0.0.0-...-0c39cf3 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package fs provides filesystem statistics

http://www.apache.org/licenses/LICENSE-2.0.txt

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

This file incorporates work covered by the following copyright and permission notice:

Copyright 2014 Google Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeviceId

type DeviceId struct {
	Major uint
	Minor uint
}

Identifies device in system

type DeviceInfo

type DeviceInfo struct {
	Device string
	Major  uint
	Minor  uint
}

DeviceInfo holds device name and major and minor numbers

type DiskStats

type DiskStats struct {
	ReadsCompleted  uint64
	ReadsMerged     uint64
	SectorsRead     uint64
	ReadTime        uint64
	WritesCompleted uint64
	WritesMerged    uint64
	SectorsWritten  uint64
	WriteTime       uint64
	IoInProgress    uint64
	IoTime          uint64
	WeightedIoTime  uint64
}

DiskStats holds disk statistics

type DiskUsageCollector

type DiskUsageCollector struct {
	Mut       *sync.Mutex
	DiskUsage map[string]uint64
	// contains filtered or unexported fields
}

DiskUsageCollector collects container disk usage (based on `du -u` command) in the background

func (*DiskUsageCollector) GetStats

func (du *DiskUsageCollector) GetStats(stats *container.Statistics, opts container.GetStatOpt) error

GetFsStats returns filesystem statistics for a given container

func (*DiskUsageCollector) Init

func (c *DiskUsageCollector) Init()

type Fs

type Fs struct {
	DeviceInfo
	Type       FsType
	Capacity   uint64
	Free       uint64
	Available  uint64
	Inodes     uint64
	InodesFree uint64
	DiskStats  DiskStats
}

Fs holds information about device (name, minor, major), type, capacity, etc.

type FsInfo

type FsInfo interface {
	// Returns capacity and free space, in bytes, of all the ext2, ext3, ext4 filesystems on the host.
	GetGlobalFsInfo(procfs string) ([]Fs, error)

	// Returns capacity and free space, in bytes, of the set of mounts passed.
	GetFsInfoForPath(mountSet map[string]struct{}, procfs string) ([]Fs, error)

	// Returns number of bytes occupied by 'dir'.
	GetDirUsage(dir string, timeout time.Duration) (uint64, error)

	// Returns the block device info of the filesystem on which 'dir' resides.
	GetDirFsDevice(dir string) (*DeviceInfo, error)
}

FsInfo specifies methods to get filesystem information and statistics

type FsType

type FsType string

FsType is a docker filesystem type, supported: zfs, vfs and devicemapper

const (
	ZFS          FsType = "zfs"
	DeviceMapper FsType = "devicemapper"
	VFS          FsType = "vfs"
)

func (FsType) String

func (ft FsType) String() string

type RealFsInfo

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

RealFsInfo holds information about filesystem (e.g. partitions)

func (*RealFsInfo) GetDirFsDevice

func (self *RealFsInfo) GetDirFsDevice(dir string) (*DeviceInfo, error)

GetDirFsDevice returns the block device info of the filesystem on which 'dir' resides.

func (*RealFsInfo) GetDirUsage

func (self *RealFsInfo) GetDirUsage(dir string, timeout time.Duration) (uint64, error)

GetDirUsage returns number of bytes occupied by 'dir'.

func (*RealFsInfo) GetFsInfoForPath

func (self *RealFsInfo) GetFsInfoForPath(mountSet map[string]struct{}, procfs string) ([]Fs, error)

GetFsInfoForPath returns capacity and free space, in bytes, of the set of mounts passed.

func (*RealFsInfo) GetGlobalFsInfo

func (self *RealFsInfo) GetGlobalFsInfo(procfs string) ([]Fs, error)

GetGlobalFsInfo returns capacity and free space, in bytes, of all the ext2, ext3, ext4 filesystems on the host.

Jump to

Keyboard shortcuts

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