Documentation ¶
Index ¶
- Constants
- Variables
- type Binary
- type BinaryExecuter
- type Client
- type Command
- func (c *Command) CheckDirectoryTree(ctx context.Context, projid uint32, opt ProjectCommandOption) error
- func (c *Command) ClearDirectoryTree(ctx context.Context, projid uint32, opt ProjectCommandOption) error
- func (c *Command) Execute(ctx context.Context) error
- func (c *Command) LimitWithId(ctx context.Context, id uint32, quotaType QuotaType, opt LimitCommandOption) error
- func (c *Command) LimitWithName(ctx context.Context, name string, quotaType QuotaType, opt LimitCommandOption) error
- func (c *Command) OperateDirectoryTree(ctx context.Context, op ProjectOpsType, id uint32, opt ProjectCommandOption) error
- func (c *Command) Report(ctx context.Context, quotaType QuotaType, quotaTargetType QuotaTargetType, ...) (*ReportResult, error)
- func (c *Command) SetupDirectoryTree(ctx context.Context, projid uint32, opt ProjectCommandOption) error
- type Commander
- type GlobalOption
- type LimitCommandOption
- type LimitCommander
- type ProjectCheckError
- type ProjectCommandOption
- type ProjectCommander
- type ProjectIdNotSetError
- type ProjectInheritanceFlagNotSetError
- type ProjectOpsType
- type QuotaTargetType
- type QuotaType
- type ReportCommandOption
- type ReportCommander
- type ReportResult
- type ReportSet
- type ReportValue
Constants ¶
View Source
const ( ProjectDirTreeSetupOps = ProjectOpsType("Setup") ProjectDirTreeClearOps = ProjectOpsType("Clear") ProjectDirTreeCheckOps = ProjectOpsType("Check") )
View Source
const ( QuotaTypeGroup = QuotaType("Group") QuotaTypeProject = QuotaType("Project") QuotaTypeUser = QuotaType("User") )
View Source
const ( QuotaTargetTypeBlocks = QuotaTargetType("Blocks") QuotaTargetTypeInodes = QuotaTargetType("Inodes") QuotaTargetTypeRealtime = QuotaTargetType("Realtime") )
View Source
const DefaultVersionConstraint = ">= 5.13.0"
Variables ¶
View Source
var DefaultVersionCommandRegexp = regexp.MustCompile(`xfs_quota version\s(.*)\r?\n?$`)
View Source
var ProjectCheckRegexp = regexp.MustCompile(`^(.*) - project inheritance flag is not set`)
View Source
var ProjectIdNotSetRegexp = regexp.MustCompile(`^(.*) - project identifier is not set`)
View Source
var ProjectInheritanceFlagNotSetRegexp = regexp.MustCompile(`^(.*) - project inheritance flag is not set`)
Functions ¶
This section is empty.
Types ¶
type Binary ¶ added in v0.1.0
type Binary struct { // The path to xfs_quota binary Path string }
type BinaryExecuter ¶
type Client ¶ added in v0.1.0
type Client struct { // xfs_quota binary Binary BinaryExecuter // xfs_quota will only run if it satisfies the constraints of this version. VersionConstraint string // Ignore version checking if true. (Default is false) IgnoreVersionConstraint bool // Regexp used for parsing stdout of version command. (DefaultVersionCommandRegexp is used normally) VersionCommandRegexp *regexp.Regexp }
xfs_quota wrapper client.
func (*Client) Command ¶ added in v0.1.0
func (c *Client) Command(filesystemPath string, opt *GlobalOption) Commander
func (*Client) GetBinaryVersion ¶ added in v0.1.0
type Command ¶
type Command struct { GlobalOpt GlobalOption Stdout io.Writer Stderr io.Writer Binary BinaryExecuter // The path argument can be used to specify mount points or device files which identify XFS filesystems. The output of the individual xfs_quota commands will then be restricted to the set of filesystems specified. // NOTE: This argument is optional on original xfs_quota but required on current go-xfsquota-wrapper version. FileSystemPath string // contains filtered or unexported fields }
func NewCommand ¶
func NewCommand(binary BinaryExecuter, filesystemPath string, globalOpt *GlobalOption) *Command
func (*Command) CheckDirectoryTree ¶ added in v0.1.0
func (*Command) ClearDirectoryTree ¶ added in v0.1.0
func (*Command) LimitWithId ¶
func (*Command) LimitWithName ¶
func (*Command) OperateDirectoryTree ¶ added in v0.1.0
func (c *Command) OperateDirectoryTree(ctx context.Context, op ProjectOpsType, id uint32, opt ProjectCommandOption) error
func (*Command) Report ¶
func (c *Command) Report(ctx context.Context, quotaType QuotaType, quotaTargetType QuotaTargetType, opt ReportCommandOption) (*ReportResult, error)
func (*Command) SetupDirectoryTree ¶ added in v0.1.0
type Commander ¶
type Commander interface { Execute(ctx context.Context) error OperateDirectoryTree(ctx context.Context, op ProjectOpsType, id uint32, opt ProjectCommandOption) error LimitCommander ReportCommander ProjectCommander }
type GlobalOption ¶
type GlobalOption struct { // Equeal to "-p" flag on commandline. // Set the program name for prompts and some error messages, the default value is xfs_quota. ProgramName string // Equeal to "-x" flag on commandline. // Enable expert mode. All of the administrative commands which allow modifications to the quota system are available only in expert mode. EnableExpertMode bool // Equeal to "-d" flag on commandline. // Project names or numeric identifiers may be specified with this option, which restricts the output of the individual xfs_quota commands to the set of projects specified. Projects []string }
type LimitCommandOption ¶
type LimitCommandOption struct { // Equal to `bsoft=N` (N > 0) argument on commandline. // Set quota block soft limits. Bsoft uint32 // Equal to `bhard=N` (N > 0) argument on commandline. // Set quota block hard limits. Bhard uint32 // Equal to `isoft=N` argument on commandline. // Set quota inode count soft limits. Isoft uint32 // Equal to `ihard=N` (N > 0) argument on commandline. // Set quota inode count hard limits. Ihard uint32 // Equal to `rtbsoft=N` (N > 0) argument on commandline. // Set quota realtime block soft limits. Rtbsoft uint32 // Equal to `rtbhard=N` (N > 0) argument on commandline. // Set quota realtime block hard limits. Rtbhard uint32 // Equal to `bsoft=0` (N > 0) argument on commandline. // Reset quota block soft limits. ResetBsoft bool // Equal to `bhard=0` argument on commandline. // Reset quota block hard limits. ResetBhard bool // Equal to `isoft=0` argument on commandline. // Reset quota inode count soft limits. ResetIsoft bool // Equal to `ihard=0` argument on commandline. // Reset quota inode count hard limits. ResetIhard bool // Equal to `rtbsoft=0` argument on commandline. // Reset quota realtime block soft limits. ResetRtbsoft bool // Equal to `rtbhard=0` argument on commandline. // Reset quota realtime block hard limits. ResetRtbhard bool }
type LimitCommander ¶
type ProjectCheckError ¶
type ProjectCheckError struct {
Errors []error
}
func (*ProjectCheckError) Error ¶
func (e *ProjectCheckError) Error() string
type ProjectCommandOption ¶
type ProjectCommandOption struct { // Equeal to "-d" flag on commandline. // This option allows to limit recursion level when processing project directories Depth uint32 // Equeal to "-p" flag on commandline. // This option allows to specify project paths at command line ( instead of /etc/projects ). Path string }
type ProjectCommander ¶
type ProjectCommander interface { // SetupDirectoryTree setup directory tree to project identified by projid. // Equeal to "project" subcommand with "-s" flag SetupDirectoryTree(ctx context.Context, projid uint32, opt ProjectCommandOption) error // ClearDirectoryTree clear directory tree to project identified by projid. // Equeal to "project" subcommand with "-C" flag ClearDirectoryTree(ctx context.Context, projid uint32, opt ProjectCommandOption) error // CheckDirectoryTree check directory tree to project identified by projid. // Equeal to "project" subcommand with "-c" flag CheckDirectoryTree(ctx context.Context, projid uint32, opt ProjectCommandOption) error }
type ProjectIdNotSetError ¶
type ProjectIdNotSetError struct {
Directory string
}
func (*ProjectIdNotSetError) Error ¶
func (e *ProjectIdNotSetError) Error() string
type ProjectInheritanceFlagNotSetError ¶
type ProjectInheritanceFlagNotSetError struct {
Directory string
}
func (*ProjectInheritanceFlagNotSetError) Error ¶
func (e *ProjectInheritanceFlagNotSetError) Error() string
type QuotaTargetType ¶
type QuotaTargetType string
func (QuotaTargetType) Flag ¶
func (t QuotaTargetType) Flag() string
type ReportCommandOption ¶
type ReportCommander ¶
type ReportCommander interface {
Report(ctx context.Context, quotaType QuotaType, quotaTargetType QuotaTargetType, opt ReportCommandOption) (*ReportResult, error)
}
type ReportResult ¶
type ReportResult struct {
ReportSets []ReportSet
}
type ReportSet ¶
type ReportSet struct { QuotaType QuotaType QuotaTargetType QuotaTargetType MountPath string DevicePath string ReportValues []ReportValue }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.