fsquota

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2018 License: MIT Imports: 15 Imported by: 2

README

fsquota

license GoDoc Build Status codecov Go Report Card

fsquota is a native Go library for interacting with (Linux) filesystem quotas. This library does not make use of cgo or invoke external commands, but rather interacts directly with the kernel interface by use of syscalls. This library is maintained by the Anexia R&D team.

Portability

fsquota has been developed with Linux in mind and as such only supports Linux for now. Support for other platforms may be added in the future.

fsqm

This repository also ships fsqm, a simple command line interface to filesystem quotas. fsqm provides the ability to retrieve user and group quota reports and management of user and group quotas.

fsqm can be obtained from the releases page.

Issue tracker

Issues in fsquota are tracked using the corresponding GitHub project's issue tracker.

Status

The current release is v0.1.3.

Changes to fsquota are subject to semantic versioning.

License

fsquota is licensed under the terms of the MIT license.

Documentation

Overview

Package fsquota provides functions for working with filesystem quotas

Index

Constants

View Source
const VersionMajor = 0

Major version

View Source
const VersionMinor = 1

Minor version

View Source
const VersionPatch = 2

Patch version

Variables

This section is empty.

Functions

func GroupQuotasSupported added in v0.1.3

func GroupQuotasSupported(path string) (supported bool, err error)

GroupQuotasSupported checks if group quotas are supported on a given path

func UserQuotasSupported added in v0.1.3

func UserQuotasSupported(path string) (supported bool, err error)

UserQuotasSupported checks if quotas are supported on a given path

func VersionString

func VersionString() string

VersionString returns the complete version string

Types

type Info

type Info struct {
	Limits

	// Byte usage
	BytesUsed uint64
	// File usage
	FilesUsed uint64
}

Info contains quota information

func GetGroupInfo

func GetGroupInfo(path string, group *user.Group) (info *Info, err error)

GetGroupInfo retrieves a group's quota information

func GetUserInfo

func GetUserInfo(path string, user *user.User) (info *Info, err error)

GetUserInfo retrieves a user's quota information

func SetGroupQuota

func SetGroupQuota(path string, group *user.Group, limits Limits) (info *Info, err error)

SetGroupQuota configures a group's quota

func SetUserQuota

func SetUserQuota(path string, user *user.User, limits Limits) (info *Info, err error)

SetUserQuota configures a user's quota

type Limit

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

Limit represents a combined hard and soft limit

func (*Limit) GetHard

func (l *Limit) GetHard() (limit uint64)

GetHard retrieves the hard limit

func (*Limit) GetSoft

func (l *Limit) GetSoft() (limit uint64)

GetSoft retrieves the soft limit

func (*Limit) SetHard

func (l *Limit) SetHard(limit uint64)

SetHard sets the hard limit

func (*Limit) SetSoft

func (l *Limit) SetSoft(limit uint64)

SetSoft sets the soft limit

type Limits

type Limits struct {
	// Byte usage limits
	Bytes Limit

	// File count limits
	Files Limit
}

Limits contains quota limits

type Report

type Report struct {
	// Map of user or group to info structure
	Infos map[string]*Info
}

Report contains a quota report

func GetGroupReport

func GetGroupReport(path string) (report *Report, err error)

GetGroupReport retrieves a report of all group quotas present at the given path

func GetUserReport

func GetUserReport(path string) (report *Report, err error)

GetUserReport retrieves a report of all user quotas present at the given path

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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