attr

package
v0.0.0-...-4b497b0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2014 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FuseAttrEq

func FuseAttrEq(a *fuse.Attr, b *fuse.Attr) bool

func ServeRPC

func ServeRPC(s *Server, rwc io.ReadWriteCloser)

ServeRPC starts an RPC server on rwc. It should typically be used in a goroutine.

func SplitPath

func SplitPath(name string) (dir, base string)

TODO - move into fuse

Types

type AttrRequest

type AttrRequest struct {
	Name string

	// Worker asking for the request. Useful for debugging.
	Origin string
}

type AttrResponse

type AttrResponse struct {
	Attrs []*FileAttr
}

type AttributeCache

type AttributeCache struct {
	Paranoia bool
	// contains filtered or unexported fields
}

A in-memory cache of attributes.

Invariants: for all entries, we have their parent directories too

func NewAttributeCache

func NewAttributeCache(getter func(n string) *FileAttr,
	statter func(n string) *fuse.Attr) *AttributeCache

NewAttributeCache creates a new AttrCache. Its arguments are a function to fetch attributes remotely (for individual attributes), and a stat function (for bulk refreshing data).

func (*AttributeCache) AddClient

func (me *AttributeCache) AddClient(client AttributeCacheClient)

func (*AttributeCache) Copy

func (me *AttributeCache) Copy() FileSet

func (*AttributeCache) Get

func (me *AttributeCache) Get(name string) (rep *FileAttr)

func (*AttributeCache) GetDir

func (me *AttributeCache) GetDir(name string) (rep *FileAttr)

func (*AttributeCache) Have

func (me *AttributeCache) Have(name string) bool

func (*AttributeCache) Queue

func (me *AttributeCache) Queue(fs FileSet)

func (*AttributeCache) Refresh

func (me *AttributeCache) Refresh(prefix string) FileSet

func (*AttributeCache) RmClient

func (me *AttributeCache) RmClient(client AttributeCacheClient)

func (*AttributeCache) Send

func (me *AttributeCache) Send(client AttributeCacheClient) error

func (*AttributeCache) Update

func (me *AttributeCache) Update(files []*FileAttr)

func (*AttributeCache) Verify

func (me *AttributeCache) Verify()

type AttributeCacheClient

type AttributeCacheClient interface {
	Id() string
	Send([]*FileAttr) error
}

type Client

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

Client is an RPC client for a remote AttrCache.

func NewClient

func NewClient(c io.ReadWriteCloser, id string) *Client

NewClient instantiates a Client. The ID string is used for identifying the client in remote logs.

func (*Client) Close

func (c *Client) Close()

func (*Client) GetAttr

func (c *Client) GetAttr(n string, wanted *FileAttr) error

GetAttr returns the attributes for a path.

type EncodedAttr

type EncodedAttr struct {
	Size    uint64
	Mtimens uint64
	Perm    uint16
	Nlink   uint16
}

EncodedAttr is the key that we use for file content equality. It is smaller than syscall.Stat_t and similar structures so it can be efficiently stored as extended attribute.

func (*EncodedAttr) Decode

func (e *EncodedAttr) Decode(in []byte) (hash []byte)

func (*EncodedAttr) Encode

func (e *EncodedAttr) Encode(h string) []byte

func (*EncodedAttr) Eq

func (e *EncodedAttr) Eq(b *EncodedAttr) bool

func (*EncodedAttr) FromAttr

func (e *EncodedAttr) FromAttr(a *fuse.Attr)

func (*EncodedAttr) ReadXAttr

func (e *EncodedAttr) ReadXAttr(path string) (hash []byte)

type FileAttr

type FileAttr struct {
	// Full path of the file
	Path string

	// Attr holds the FUSE attributes
	*fuse.Attr

	// Hash holds the cryptographic has of the file, in case of a
	// normal file.
	Hash string

	// Link holds the link target in case of a symlink.
	Link string

	// Only filled for directories.
	NameModeMap map[string]FileMode
}

func (FileAttr) Copy

func (me FileAttr) Copy(withdir bool) *FileAttr

func (FileAttr) Deletion

func (me FileAttr) Deletion() bool

func (*FileAttr) IsBlock

func (me *FileAttr) IsBlock() bool

IsBlock reports whether the FileInfo describes a block special file.

func (*FileAttr) IsChar

func (me *FileAttr) IsChar() bool

IsChar reports whether the FileInfo describes a character special file.

func (*FileAttr) IsDir

func (me *FileAttr) IsDir() bool

IsDir reports whether the FileInfo describes a directory.

func (*FileAttr) IsFifo

func (me *FileAttr) IsFifo() bool

func (*FileAttr) IsRegular

func (me *FileAttr) IsRegular() bool

IsRegular reports whether the FileInfo describes a regular file.

func (*FileAttr) IsSocket

func (me *FileAttr) IsSocket() bool

IsSocket reports whether the FileInfo describes a socket.

func (me *FileAttr) IsSymlink() bool

IsSymlink reports whether the FileInfo describes a symbolic link.

func (FileAttr) LongString

func (me FileAttr) LongString() string

func (*FileAttr) Merge

func (me *FileAttr) Merge(r FileAttr)

func (*FileAttr) ReadFromFs

func (me *FileAttr) ReadFromFs(p string, hashFunc crypto.Hash)

func (FileAttr) Status

func (me FileAttr) Status() fuse.Status

func (FileAttr) String

func (me FileAttr) String() string

func (*FileAttr) WriteXAttr

func (a *FileAttr) WriteXAttr(p string)

type FileMode

type FileMode uint32

func (FileMode) String

func (m FileMode) String() string

type FileSet

type FileSet struct {
	Files []*FileAttr
}

func (*FileSet) Len

func (me *FileSet) Len() int

func (*FileSet) Less

func (me *FileSet) Less(i, j int) bool

func (*FileSet) Sort

func (me *FileSet) Sort()

func (*FileSet) String

func (me *FileSet) String() string

func (*FileSet) Swap

func (me *FileSet) Swap(i, j int)

type FileSetWaiter

type FileSetWaiter struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewFileSetWaiter

func NewFileSetWaiter(proc func(FileSet) error) *FileSetWaiter

func (*FileSetWaiter) Prepare

func (me *FileSetWaiter) Prepare(id int)

func (*FileSetWaiter) Wait

func (me *FileSetWaiter) Wait(fs *FileSet, taskids []int, waitId int) (err error)

type Server

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

func NewServer

func NewServer(a *AttributeCache, timings *stats.TimerStats) *Server

NewServer instantiates an RPC server for the given AttributeCache. If timings is optional and will be used for recording timing data.

func (*Server) GetAttr

func (s *Server) GetAttr(req *AttrRequest, rep *AttrResponse) error

GetAttr is an RPC entry point. The name in AttrRequest should be absolute

Jump to

Keyboard shortcuts

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