boolexpr

package
v0.0.0-...-2c34a8a Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

README

Package cloudeng.io/cmd/idu/internal/boolexpr

CircleCI Go Report Card

import cloudeng.io/cmd/idu/internal/boolexpr

Package boolexpr provides a wrapper for cloudeng.io/cmdutil/boolexpr for use with idu.

Functions

func NewHardlink(ctx context.Context, n, v string, fs file.FS) boolexpr.Operand

NewHardlink returns an operand that determines if the supplied value is, or is not, a hardlink to the specified file or directory.

Func NewParser
func NewParser(ctx context.Context, fs filewalk.FS) *boolexpr.Parser
Func NewParserTests
func NewParserTests(ctx context.Context, fs filewalk.FS) *boolexpr.Parser

NewParserTests registers user and group operands that will accept any uid/gid rather than testing to ensure that they exist.

Types

Type Matcher
type Matcher struct {
	// contains filtered or unexported fields
}
Functions
func AlwaysMatch(p *boolexpr.Parser) Matcher
func CreateMatcher(parser *boolexpr.Parser, opts ...Option) (Matcher, error)
Methods
func (m Matcher) Entry(prefix string, pi *prefixinfo.T, fi file.Info) bool
func (m Matcher) IsHardlink(xattr file.XAttr) bool
func (m Matcher) Prefix(prefix string, pi *prefixinfo.T) bool
func (m Matcher) String() string
Type Option
type Option func(o *options)
Functions
func WithEmptyEntryValue(v bool) Option
func WithEntryExpression(expr ...string) Option
func WithFilewalkFS(fs filewalk.FS) Option
func WithHardlinkHandling(v bool) Option

WithHardlinkHandling enables incrmental detection of hardlinks so as to avoid visiting the second and subsequent file system entries that represent the same file. This is primarily useful for avoiding overcounting the resources shared by hardlinks. With this option enabled, the matcher's Entry method will return false for any file that has already been seen (based on its device and inode numbers).

Documentation

Overview

Package boolexpr provides a wrapper for cloudeng.io/cmdutil/boolexpr for use with idu.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHardlink(ctx context.Context, n, v string, fs file.FS) boolexpr.Operand

NewHardlink returns an operand that determines if the supplied value is, or is not, a hardlink to the specified file or directory.

func NewParser

func NewParser(ctx context.Context, fs filewalk.FS) *boolexpr.Parser

func NewParserTests

func NewParserTests(ctx context.Context, fs filewalk.FS) *boolexpr.Parser

NewParserTests registers user and group operands that will accept any uid/gid rather than testing to ensure that they exist.

Types

type Matcher

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

func AlwaysMatch

func AlwaysMatch(p *boolexpr.Parser) Matcher

func CreateMatcher

func CreateMatcher(parser *boolexpr.Parser, opts ...Option) (Matcher, error)

func (Matcher) Entry

func (m Matcher) Entry(prefix string, pi *prefixinfo.T, fi file.Info) bool
func (m Matcher) IsHardlink(xattr file.XAttr) bool

func (Matcher) Prefix

func (m Matcher) Prefix(prefix string, pi *prefixinfo.T) bool

func (Matcher) String

func (m Matcher) String() string

type Option

type Option func(o *options)

func WithEmptyEntryValue

func WithEmptyEntryValue(v bool) Option

func WithEntryExpression

func WithEntryExpression(expr ...string) Option

func WithFilewalkFS

func WithFilewalkFS(fs filewalk.FS) Option

func WithHardlinkHandling

func WithHardlinkHandling(v bool) Option

WithHardlinkHandling enables incrmental detection of hardlinks so as to avoid visiting the second and subsequent file system entries that represent the same file. This is primarily useful for avoiding overcounting the resources shared by hardlinks. With this option enabled, the matcher's Entry method will return false for any file that has already been seen (based on its device and inode numbers).

Jump to

Keyboard shortcuts

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