openfiletable

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package openfiletable maintains a table of currently opened files, identified by the device number + inode number pair. This table is used by fusefrontend to centrally store the current file ID and to lock files against concurrent writes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountOpenFiles added in v1.7.1

func CountOpenFiles() int

CountOpenFiles returns how many entries are currently in the table in a threadsafe manner.

func Unregister

func Unregister(qi inomap.QIno)

Unregister decrements the reference count for "qi" and deletes the entry from the open file table if the reference count reaches 0.

func WriteOpCount

func WriteOpCount() uint64

WriteOpCount returns the write lock counter value. This value is incremented each time writeLock.Lock() on a file table entry is called.

Types

type Entry

type Entry struct {

	// ContentLock protects on-disk content from concurrent writes. Every writer
	// must take this lock before modifying the file content.
	ContentLock countingMutex
	// ID is the file ID in the file header.
	ID []byte
	// IDLock must be taken before reading or writing the ID field in this struct,
	// unless you have an exclusive lock on ContentLock.
	IDLock sync.Mutex
	// contains filtered or unexported fields
}

Entry is an entry in the open file table

func Register

func Register(qi inomap.QIno) *Entry

Register creates an open file table entry for "qi" (or incrementes the reference count if the entry already exists) and returns the entry.

Jump to

Keyboard shortcuts

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