fs

package
v0.0.0-...-be3b37f Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package fs implements the FUSE filesystem

Index

Constants

View Source
const (
	// NodeKeyLen is the default node key length
	NodeKeyLen int = 20
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DinoNode

type DinoNode struct {
	fs.Inode

	User  uint32
	Group uint32
	Mode  uint32
	Time  time.Time

	// Used as the Key to save/retrieve this node in the metadata store. It's a
	// sort of inode number, but it's not assigned by a central entity and can't
	// be reused.
	Key [NodeKeyLen]byte

	// Only makes sense for directories:
	Children map[string]*DinoNode
	// contains filtered or unexported fields
}

DinoNode holds information about a filesystem node and implements the FUSE filesystem interface

func (*DinoNode) Create

func (node *DinoNode) Create(ctx context.Context, name string, flags uint32, mode uint32, out *fuse.EntryOut) (*fs.Inode, fs.FileHandle, uint32, syscall.Errno)

Create ...

func (*DinoNode) Flush

func (node *DinoNode) Flush(ctx context.Context, f fs.FileHandle) syscall.Errno

Flush ...

func (*DinoNode) Fsync

func (node *DinoNode) Fsync(ctx context.Context, f fs.FileHandle, flags uint32) syscall.Errno

Fsync ...

func (*DinoNode) Getattr

func (node *DinoNode) Getattr(ctx context.Context, f fs.FileHandle, out *fuse.AttrOut) syscall.Errno

Getattr ...

func (*DinoNode) Getxattr

func (node *DinoNode) Getxattr(ctx context.Context, attr string, dest []byte) (uint32, syscall.Errno)

Getxattr should read data for the given attribute into `dest` and return the number of bytes. If `dest` is too small, it should return ERANGE and the size of the attribute. If not defined, Getxattr will return ENOATTR.

func (*DinoNode) LoadMetadata

func (node *DinoNode) LoadMetadata(key [NodeKeyLen]byte) error

LoadMetadata loads metadata for a node

func (*DinoNode) Lookup

func (node *DinoNode) Lookup(ctx context.Context, name string, out *fuse.EntryOut) (*fs.Inode, syscall.Errno)

Lookup ...

func (*DinoNode) Mkdir

func (node *DinoNode) Mkdir(ctx context.Context, name string, mode uint32, out *fuse.EntryOut) (*fs.Inode, syscall.Errno)

Mkdir ...

func (*DinoNode) Open

func (node *DinoNode) Open(ctx context.Context, flags uint32) (fh fs.FileHandle, fuseFlags uint32, errno syscall.Errno)

Open ...

func (*DinoNode) Opendir

func (node *DinoNode) Opendir(ctx context.Context) syscall.Errno

Opendir ...

func (*DinoNode) Read

func (node *DinoNode) Read(ctx context.Context, f fs.FileHandle, dest []byte, off int64) (fuse.ReadResult, syscall.Errno)
func (node *DinoNode) Readlink(ctx context.Context) ([]byte, syscall.Errno)

Readlink ...

func (*DinoNode) Release

func (node *DinoNode) Release(ctx context.Context, f fs.FileHandle) syscall.Errno

Release would sync writes to mmap-ed files.

func (*DinoNode) Rename

func (node *DinoNode) Rename(ctx context.Context, name string, newParent fs.InodeEmbedder, newName string, flags uint32) syscall.Errno

Rename ...

func (*DinoNode) Rmdir

func (node *DinoNode) Rmdir(ctx context.Context, name string) syscall.Errno

Rmdir ...

func (*DinoNode) Setattr

func (node *DinoNode) Setattr(ctx context.Context, f fs.FileHandle, in *fuse.SetAttrIn, out *fuse.AttrOut) syscall.Errno

Setattr ...

func (*DinoNode) Setxattr

func (node *DinoNode) Setxattr(ctx context.Context, attr string, data []byte, flags uint32) syscall.Errno

Setxattr ...

func (*DinoNode) Statfs

func (node *DinoNode) Statfs(ctx context.Context, out *fuse.StatfsOut) syscall.Errno

Statfs implements the fs.NodeStatfser interface

func (node *DinoNode) Symlink(ctx context.Context, target, name string, out *fuse.EntryOut) (*fs.Inode, syscall.Errno)

Symlink ...

func (node *DinoNode) Unlink(ctx context.Context, name string) syscall.Errno

Unlink ...

func (*DinoNode) Write

func (node *DinoNode) Write(ctx context.Context, f fs.FileHandle, data []byte, off int64) (written uint32, errno syscall.Errno)

type DinoNodeFactory

type DinoNodeFactory struct {
	Root           *DinoNode
	InodeGenerator *InodeNumbersGenerator
	Metadata       storage.VersionedStore
	Blobs          *storage.BlobStoreWrapper
	// contains filtered or unexported fields
}

DinoNodeFactory creates filesystem nodes

func (*DinoNodeFactory) ExistingNode

func (factory *DinoNodeFactory) ExistingNode(name string, key [NodeKeyLen]byte) *DinoNode

ExistingNode adds a new node

func (*DinoNodeFactory) InvalidateCache

func (factory *DinoNodeFactory) InvalidateCache(mutation message.Message)

InvalidateCache invalidates a cached node

type InodeNumbersGenerator

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

InodeNumbersGenerator generates inode numbers starting from 2 (1 is reserved for the root node)

func NewInodeNumbersGenerator

func NewInodeNumbersGenerator() *InodeNumbersGenerator

NewInodeNumbersGenerator creates a new inode generator

func (*InodeNumbersGenerator) Next

func (g *InodeNumbersGenerator) Next() uint64

Next returns the next generated inode

func (*InodeNumbersGenerator) Start

func (g *InodeNumbersGenerator) Start()

Start starts the generator

func (*InodeNumbersGenerator) Stop

func (g *InodeNumbersGenerator) Stop()

Stop stops the generator

Jump to

Keyboard shortcuts

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