access

package
v0.0.0-...-ea22f37 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootPathHashes = PathHashes{
	// contains filtered or unexported fields
}

RootPathHashes is the set of Bloom filter hashes corresponding to the root directory of the input root (i.e., the empty path).

Functions

This section is empty.

Types

type BloomFilterComputingUnreadDirectoryMonitor

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

BloomFilterComputingUnreadDirectoryMonitor is an implementation of UnreadDirectoryMonitor that is capable of computing a Bloom filter of all of the paths of files and directories that have been read.

func NewBloomFilterComputingUnreadDirectoryMonitor

func NewBloomFilterComputingUnreadDirectoryMonitor() *BloomFilterComputingUnreadDirectoryMonitor

NewBloomFilterComputingUnreadDirectoryMonitor creates an UnreadDirectoryMonitor that is capable of computing a Bloom filter of all of the paths of files and directories that have been read. The instance that is returned corresponds to the empty path (root directory).

func (*BloomFilterComputingUnreadDirectoryMonitor) GetBloomFilter

func (udm *BloomFilterComputingUnreadDirectoryMonitor) GetBloomFilter(bitsPerElement, maximumSizeBytes int) ([]byte, uint32)

GetBloomFilter returns the Bloom filter that contains all of the paths of files and directories that have been read.

The size of the resulting Bloom filter is based on the desired bits per element, and the maximum size in bits. In case it is limited by the maximum size, the resulting Bloom filter will be oversaturated, causing the probability of false positives to increase.

func (*BloomFilterComputingUnreadDirectoryMonitor) GetInputRootResourceUsage

GetInputRootResourceUsage returns statistics on how many files and directories in an input root are being accessed. This message can be attached to the auxiliary metadata of ActionResult.

func (*BloomFilterComputingUnreadDirectoryMonitor) ReadDirectory

ReadDirectory can be called to indicate that the contents of a directory have been read. It causes the directory to be added to the resulting Bloom filter.

type BloomFilterReader

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

BloomFilterReader is a helper type for doing lookups against Bloom filters that were generated using BloomFilterComputingUnreadDirectoryMonitor.

func NewBloomFilterReader

func NewBloomFilterReader(bloomFilter []byte, hashFunctions uint32) (*BloomFilterReader, error)

NewBloomFilterReader checks the validity of a Bloom filter, and returns a reader type when valid.

func (*BloomFilterReader) Contains

func (r *BloomFilterReader) Contains(pathHashes PathHashes) bool

Contains returns whether a path is contained in the Bloom filter.

type PathHashIterator

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

PathHashIterator is capable of yielding a sequence of hashes corresponding to a given path.

func (*PathHashIterator) GetNextHash

func (hi *PathHashIterator) GetNextHash() uint64

GetNextHash progresses the PathHashIterator and returns the next hash corresponding to a given path.

type PathHashes

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

PathHashes is a set of Bloom filter hashes corresponding to a given path in the input root.

func NewPathHashesFromBaseHash

func NewPathHashesFromBaseHash(baseHash uint64) PathHashes

NewPathHashesFromBaseHash creates a new set of Bloom filter hashes corresponding to an explicit base hash value.

func (PathHashes) AppendComponent

func (hf PathHashes) AppendComponent(name path.Component) PathHashes

AppendComponent returns a new set of Bloom filter hashes corresponding to a child of the current directory.

func (PathHashes) Finalize

func (hf PathHashes) Finalize() PathHashIterator

Finalize the set of Bloom filter hashes corresponding to the current path, and return a PathHashIterator to extract these hashes.

func (PathHashes) GetBaseHash

func (hf PathHashes) GetBaseHash() uint64

GetBaseHash returns the base hash value of a set of Bloom filter hashes. This can be used to preserve and restore an instance of PathHashes.

type ReadDirectoryMonitor

type ReadDirectoryMonitor interface {
	ResolvedDirectory(name path.Component) UnreadDirectoryMonitor
	ReadFile(name path.Component)
}

ReadDirectoryMonitor is used to report file system access activity against a directory whose contents have been read. It is possible to report resolution of child directories, and reads against child files.

type UnreadDirectoryMonitor

type UnreadDirectoryMonitor interface {
	ReadDirectory() ReadDirectoryMonitor
}

UnreadDirectoryMonitor is used to report file system access activity against a directory whose contents have not yet been read.

Jump to

Keyboard shortcuts

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