nodes

package
v1.4.8 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BranchSegmentNode

type BranchSegmentNode struct {
	fs.Inode
	// contains filtered or unexported fields
}

BranchSegmentNode is a node that represents a segment of a branch name. For example, if the branch name is "foo/bar/baz", then there will be three BranchSegmentNodes, one for "foo", one for "bar", and one for "baz".

func NewBranchSegmentNode

func NewBranchSegmentNode(repository *git.Repository, branchPrefix string) *BranchSegmentNode

NewBranchSegmentNode creates a new BranchSegmentNode.

func (*BranchSegmentNode) Lookup

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

Lookup returns the child node with the given name. If the name is a branch name, then a new ObjectTreeNode is returned. Otherwise, a new BranchSegmentNode is returned. It returns ENOENT if the name is not found.

func (*BranchSegmentNode) Readdir

Readdir returns the child nodes of this node. The child nodes are the branches that start with the branch prefix. For example, if branch names are "foo/bar" and "foo/buz", then will return "foo" directory with two children, "bar" and "buz".

type BranchesNode

type BranchesNode struct {
	fs.Inode
	// contains filtered or unexported fields
}

BranchesNode is a filesystem node that represents a list of branches. It is a directory that contains a list of branches. Each branch is a directory. If branch contains directory separator, it will be split into segments and each segment will be a nested directory. For example, if branch name is "foo/bar", it will be represented as "foo" directory with "bar" directory inside.

func NewBranchesNode

func NewBranchesNode(repository *git.Repository) *BranchesNode

NewBranchesNode creates a new BranchesNode.

func (*BranchesNode) Lookup

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

Lookup returns a branch commit three node or a branch segment node. If branch name is "foo", it will return a branch commit tree node. If branch name is "foo/bar", it will return a branch segment node with name "bar". It returns ENOENT if the name is not found.

func (*BranchesNode) Readdir

func (node *BranchesNode) Readdir(_ context.Context) (fs.DirStream, syscall.Errno)

Readdir returns a list of branches. If branch contains directory separator, it will be split into segments and each segment will be a nested directory.

type CommitsNode

type CommitsNode struct {
	fs.Inode
	// contains filtered or unexported fields
}

CommitsNode is a filesystem node that represents a list of commits. It is a child of the root node. It is a directory. It contains a list of directories, each directory represents a commit.

func NewCommitsNode

func NewCommitsNode(repository *git.Repository) *CommitsNode

NewCommitsNode creates a new CommitsNode.

func (*CommitsNode) Lookup

func (node *CommitsNode) Lookup(ctx context.Context, hash string, _ *fuse.EntryOut) (*fs.Inode, syscall.Errno)

Lookup looks up a commit by its hash. It returns a directory that represents the commit. It returns ENOENT if the name is not found.

func (*CommitsNode) Readdir

func (node *CommitsNode) Readdir(_ context.Context) (fs.DirStream, syscall.Errno)

Readdir reads the list of commits. It returns a list of directories, each directory represents a commit.

type FileHandler added in v1.3.1

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

FileHandler implements the fs.FileReader interface. It is used to read the file. It holds bytes.Reader to read the file at the given offset.

func NewFileHandler added in v1.3.1

func NewFileHandler(file *object.File, reader io.ReaderAt) *FileHandler

NewFileHandler creates a new file handler.

func (FileHandler) Read added in v1.3.1

func (h FileHandler) Read(_ context.Context, dest []byte, off int64) (fuse.ReadResult, syscall.Errno)

Read reads the file.

type FileNode

type FileNode struct {
	fs.Inode
	// contains filtered or unexported fields
}

FileNode is a file node.

func NewFileNode

func NewFileNode(file *object.File, commit *object.Commit) *FileNode

NewFileNode creates a new file node.

func (*FileNode) Getattr

func (node *FileNode) Getattr(_ context.Context, _ fs.FileHandle, out *fuse.AttrOut) syscall.Errno

Getattr gets the file attributes.

func (*FileNode) Open

func (node *FileNode) Open(_ context.Context, _ uint32) (fh fs.FileHandle, fuseFlags uint32, errno syscall.Errno)

Open opens the file.

type ObjectTreeNode

type ObjectTreeNode struct {
	fs.Inode
	// contains filtered or unexported fields
}

ObjectTreeNode is a node that represents a tree object in a git repository. It is used to represent the content of commit.

func NewObjectTreeNode

func NewObjectTreeNode(
	repository *git.Repository,
	revision string,
	commit *object.Commit,
	tree *object.Tree,
) *ObjectTreeNode

NewObjectTreeNode creates a new ObjectTreeNode.

func NewObjectTreeNodeByRevision

func NewObjectTreeNodeByRevision(repository *git.Repository, revision string) (*ObjectTreeNode, error)

NewObjectTreeNodeByRevision creates a new ObjectTreeNode by a revision name. The revision name can be a branch name, a tag name or a commit hash.

func (*ObjectTreeNode) Getattr

func (node *ObjectTreeNode) Getattr(_ context.Context, _ fs.FileHandle, out *fuse.AttrOut) syscall.Errno

func (*ObjectTreeNode) Lookup

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

func (*ObjectTreeNode) Readdir

func (node *ObjectTreeNode) Readdir(_ context.Context) (fs.DirStream, syscall.Errno)

type RootNode

type RootNode struct {
	fs.Inode
	// contains filtered or unexported fields
}

RootNode is the root node of the filesystem. It contains the following subdirectories: - branches: list of branches - commits: list of commits - tags: list of tags

func NewRootNode

func NewRootNode(repository *git.Repository) *RootNode

NewRootNode creates a new RootNode.

func (*RootNode) Lookup

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

Lookup returns the inode for the given name. It returns ENOENT if the name is not found.

func (*RootNode) Readdir

func (node *RootNode) Readdir(_ context.Context) (fs.DirStream, syscall.Errno)

Readdir returns the list of entries in the directory.

type TagSegmentNode

type TagSegmentNode struct {
	fs.Inode
	// contains filtered or unexported fields
}

TagSegmentNode is a node that represents a segment of a tag name. For example, if the tag name is "release/v1.0.0" then there will be two TagSegmentNodes, one for "release" and one for "v1.0.0".

func NewTagSegmentNode

func NewTagSegmentNode(repository *git.Repository, tagPrefix string) *TagSegmentNode

NewTagSegmentNode creates a new TagSegmentNode.

func (*TagSegmentNode) Lookup

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

Lookup returns the child node with the given name. If the name is a tag name, then a new ObjectTreeNode is returned. Otherwise, a new TagSegmentNode is returned. It returns ENOENT if the name is not found.

func (*TagSegmentNode) Readdir

func (node *TagSegmentNode) Readdir(_ context.Context) (fs.DirStream, syscall.Errno)

Readdir returns the child nodes of this node. The child nodes are the segments of the tag names. For example, if the tag names are "release/v1.0.0" and "release/v1.1.0" then will return "release" directory with two children, "v1.0.0" and "v1.1.0".

type TagsNode

type TagsNode struct {
	fs.Inode
	// contains filtered or unexported fields
}

TagsNode is a node that represents a git repository's tags. It is a directory that contains a directory for each tag. If tag contains directory separator, it will be split into segments and each segment will be a nested directory. For example, if tag name is "foo/bar", it will be represented as "foo" directory with "bar" directory inside.

func NewTagsNode

func NewTagsNode(repository *git.Repository) *TagsNode

NewTagsNode creates a new TagsNode.

func (*TagsNode) Lookup

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

Lookup returns a tag commit tree node or a tag segment node. If tag name is "foo", it will return a tag commit tree node. If tag name is "foo/bar", it will return a tag segment node with name "bar". It returns ENOENT if the name is not found.

func (*TagsNode) Readdir

func (node *TagsNode) Readdir(_ context.Context) (fs.DirStream, syscall.Errno)

Readdir returns a list of tag names. If tag name is "foo/bar", it will return "foo" directory with "bar" directory inside.

Jump to

Keyboard shortcuts

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