cachingfs

package
Version: v0.0.0-...-3a5cf19 Latest Latest
Warning

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

Go to latest
Published: May 30, 2019 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, HPND Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Sizes of the files according to the file system.
	FooSize = 123
	BarSize = 456
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CachingFS

type CachingFS interface {
	fuseutil.FileSystem

	// Return the current inode ID of the file/directory with the given name.
	FooID() fuseops.InodeID
	DirID() fuseops.InodeID
	BarID() fuseops.InodeID

	// Cause the inode IDs to change to values that have never before been used.
	RenumberInodes()

	// Cause further queries for the attributes of inodes to use the supplied
	// time as the inode's mtime.
	SetMtime(mtime time.Time)

	// Instruct the file system whether or not to reply to OpenFileOp with
	// FOPEN_KEEP_CACHE set.
	SetKeepCache(keep bool)
}

A file system with a fixed structure that looks like this:

foo
dir/
    bar

The file system is configured with durations that specify how long to allow inode entries and attributes to be cached, used when responding to fuse requests. It also exposes methods for renumbering inodes and updating mtimes that are useful in testing that these durations are honored.

Each file responds to reads with random contents. SetKeepCache can be used to control whether the response to OpenFileOp tells the kernel to keep the file's data in the page cache or not.

func NewCachingFS

func NewCachingFS(
	lookupEntryTimeout time.Duration,
	getattrTimeout time.Duration) (fs CachingFS, err error)

Create a file system that issues cacheable responses according to the following rules:

*  LookUpInodeResponse.Entry.EntryExpiration is set according to
   lookupEntryTimeout.

*  GetInodeAttributesResponse.AttributesExpiration is set according to
   getattrTimeout.

*  Nothing else is marked cacheable. (In particular, the attributes
   returned by LookUpInode are not cacheable.)

Source Files

Jump to

Keyboard shortcuts

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