handlemap

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HandleFlagUnknown uint16 = iota
	HandleFlagDirty          // File has been modified with write operation or is a new file
	HandleFlagFSynced        // User has called fsync on the file explicitly
	HandleFlagCached         // File is cached in the local system by cloudfuse
)

Flags represented in BitMap for various flags in the handle

Variables

This section is empty.

Functions

func CreateCacheObject

func CreateCacheObject(capacity int64, handle *Handle)

func Delete

func Delete(key HandleID)

Delete : Remove handle object from map

func GetHandles

func GetHandles() *sync.Map

GetHandles : Get map of handles stored

Types

type Buffers

type Buffers struct {
	Cooked  *list.List
	Cooking *list.List
}

type Cache

type Cache struct {
	sync.RWMutex
	*cache_policy.LRUCache
	*common.BlockOffsetList
	StreamOnly  bool
	HandleCount int64
}

Structure to hold in memory cache for streaming layer

type Handle

type Handle struct {
	sync.RWMutex
	FObj     *os.File // File object being represented by this handle
	CacheObj *Cache   // Streaming layer cache for this handle
	Buffers  *Buffers
	ID       HandleID // Cloudfuse assigned unique ID to this handle
	Size     int64    // Size of the file being handled here
	Mtime    time.Time
	UnixFD   uint64          // Unix FD created by create/open syscall
	OptCnt   uint64          // Number of operations done on this file
	Flags    common.BitMap16 // Various states of the file
	Path     string          // Always holds path relative to mount dir
	// contains filtered or unexported fields
}

func Load

func Load(key HandleID) (*Handle, bool)

Load : Search the handle object based on its id

func NewHandle

func NewHandle(path string) *Handle

func Store

func Store(key HandleID, path string, _ uintptr) *Handle

Store function must not be used in production application. This is a utility function present only for test scenarios.

func (*Handle) Cached

func (handle *Handle) Cached() bool

Cached : File is cached on local disk or not

func (*Handle) Cleanup

func (handle *Handle) Cleanup()

Cleanup : Delete all user defined parameter from handle

func (*Handle) Dirty

func (handle *Handle) Dirty() bool

Dirty : Handle is dirty or not

func (*Handle) FD

func (handle *Handle) FD() int

FD : Get Unix file descriptor

func (*Handle) Fsynced

func (handle *Handle) Fsynced() bool

Fsynced : Handle is Fsynced or not

func (*Handle) GetFileObject

func (handle *Handle) GetFileObject() *os.File

GetFileObject : Get the OS.File handle stored within

func (*Handle) GetValue

func (handle *Handle) GetValue(key string) (interface{}, bool)

GetValue : Retrieve user defined parameter from handle

func (*Handle) RemoveValue

func (handle *Handle) RemoveValue(key string) (interface{}, bool)

GetValue : Retrieve user defined parameter from handle

func (*Handle) SetFileObject

func (handle *Handle) SetFileObject(f *os.File)

SetFileObject : Store the OS.File handle

func (*Handle) SetValue

func (handle *Handle) SetValue(key string, value interface{})

SetValue : Store user defined parameter inside handle

type HandleID

type HandleID uint64
const InvalidHandleID HandleID = 0

func Add

func Add(handle *Handle) HandleID

Add : Add the newly created handle to map and allocate a handle id

Jump to

Keyboard shortcuts

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