unixfs_git

package
v0.53.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package unixfs_git implements a git-backed FSCursor.

Index

Constants

This section is empty.

Variables

View Source
var ErrDotGitWriteNotImplemented = errors.New("dotgit write support is not implemented")

ErrDotGitWriteNotImplemented is returned by writable .git cursors before semantic writes are implemented.

Functions

This section is empty.

Types

type DotGitFSCursor

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

DotGitFSCursor implements unixfs.FSCursor for a materialized .git directory.

func NewDotGitFSCursor

func NewDotGitFSCursor(tx hydra_git.Tx, name string) *DotGitFSCursor

NewDotGitFSCursor creates a new read-only .git directory cursor.

func NewDotGitFSCursorWithOptions

func NewDotGitFSCursorWithOptions(tx hydra_git.Tx, name string, opts ...DotGitFSCursorOption) *DotGitFSCursor

NewDotGitFSCursorWithOptions creates a new .git directory cursor.

func (*DotGitFSCursor) AddChangeCb

func (c *DotGitFSCursor) AddChangeCb(cb unixfs.FSCursorChangeCb)

AddChangeCb is a no-op for the initial read-only cursor.

func (*DotGitFSCursor) CheckReleased

func (c *DotGitFSCursor) CheckReleased() bool

CheckReleased checks if the cursor is released.

func (*DotGitFSCursor) GetCursorOps

func (c *DotGitFSCursor) GetCursorOps(ctx context.Context) (unixfs.FSCursorOps, error)

GetCursorOps returns the FSCursorOps for this cursor.

func (*DotGitFSCursor) GetProxyCursor

func (c *DotGitFSCursor) GetProxyCursor(ctx context.Context) (unixfs.FSCursor, error)

GetProxyCursor returns nil, nil because repository layout nodes do not proxy.

func (*DotGitFSCursor) Release

func (c *DotGitFSCursor) Release()

Release releases the cursor.

type DotGitFSCursorChangeSource

type DotGitFSCursorChangeSource interface {
	AddDotGitChangeCb(cb func()) func()
}

DotGitFSCursorChangeSource registers coarse invalidation callbacks for a repo.

type DotGitFSCursorOps

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

DotGitFSCursorOps implements unixfs.FSCursorOps for .git layout nodes.

func (*DotGitFSCursorOps) CheckReleased

func (o *DotGitFSCursorOps) CheckReleased() bool

CheckReleased checks if the ops is released.

func (*DotGitFSCursorOps) CopyFrom

func (o *DotGitFSCursorOps) CopyFrom(ctx context.Context, name string, srcCursorOps unixfs.FSCursorOps, ts time.Time) (bool, error)

CopyFrom returns false, nil.

func (*DotGitFSCursorOps) CopyTo

func (o *DotGitFSCursorOps) CopyTo(ctx context.Context, tgtDir unixfs.FSCursorOps, tgtName string, ts time.Time) (bool, error)

CopyTo returns false, nil.

func (*DotGitFSCursorOps) GetIsDirectory

func (o *DotGitFSCursorOps) GetIsDirectory() bool

GetIsDirectory returns if the node is a directory.

func (*DotGitFSCursorOps) GetIsFile

func (o *DotGitFSCursorOps) GetIsFile() bool

GetIsFile returns if the node is a regular file.

func (o *DotGitFSCursorOps) GetIsSymlink() bool

GetIsSymlink returns false because .git seed nodes are not symlinks.

func (*DotGitFSCursorOps) GetModTimestamp

func (o *DotGitFSCursorOps) GetModTimestamp(ctx context.Context) (time.Time, error)

GetModTimestamp returns the modification timestamp.

func (*DotGitFSCursorOps) GetName

func (o *DotGitFSCursorOps) GetName() string

GetName returns the name of the node.

func (*DotGitFSCursorOps) GetOptimalWriteSize

func (o *DotGitFSCursorOps) GetOptimalWriteSize(ctx context.Context) (int64, error)

GetOptimalWriteSize returns the preferred write size.

func (*DotGitFSCursorOps) GetPermissions

func (o *DotGitFSCursorOps) GetPermissions(ctx context.Context) (fs.FileMode, error)

GetPermissions returns the permissions for this node.

func (*DotGitFSCursorOps) GetSize

func (o *DotGitFSCursorOps) GetSize(ctx context.Context) (uint64, error)

GetSize returns the node size in bytes.

func (*DotGitFSCursorOps) Lookup

func (o *DotGitFSCursorOps) Lookup(ctx context.Context, name string) (unixfs.FSCursor, error)

Lookup looks up a child entry in a directory.

func (*DotGitFSCursorOps) Mknod

func (o *DotGitFSCursorOps) Mknod(ctx context.Context, checkExist bool, names []string, nodeType unixfs.FSCursorNodeType, permissions fs.FileMode, ts time.Time) error

Mknod rejects or stages node creation.

func (*DotGitFSCursorOps) MknodWithContent

func (o *DotGitFSCursorOps) MknodWithContent(ctx context.Context, name string, nodeType unixfs.FSCursorNodeType, dataLen int64, rdr io.Reader, permissions fs.FileMode, ts time.Time) error

MknodWithContent rejects or stages file creation with content.

func (*DotGitFSCursorOps) MoveFrom

func (o *DotGitFSCursorOps) MoveFrom(ctx context.Context, name string, srcCursorOps unixfs.FSCursorOps, ts time.Time) (bool, error)

MoveFrom rejects or stages a move from another cursor.

func (*DotGitFSCursorOps) MoveTo

func (o *DotGitFSCursorOps) MoveTo(ctx context.Context, tgtCursorOps unixfs.FSCursorOps, tgtName string, ts time.Time) (bool, error)

MoveTo rejects or stages a move into another directory.

func (*DotGitFSCursorOps) ReadAt

func (o *DotGitFSCursorOps) ReadAt(ctx context.Context, offset int64, data []byte) (int64, error)

ReadAt reads file content from the node.

func (*DotGitFSCursorOps) ReaddirAll

func (o *DotGitFSCursorOps) ReaddirAll(ctx context.Context, skip uint64, cb func(ent unixfs.FSCursorDirent) error) error

ReaddirAll reads all directory entries.

func (o *DotGitFSCursorOps) Readlink(ctx context.Context, name string) ([]string, bool, error)

Readlink returns ErrNotSymlink.

func (*DotGitFSCursorOps) Remove

func (o *DotGitFSCursorOps) Remove(ctx context.Context, names []string, ts time.Time) error

Remove rejects or stages entry removal.

func (*DotGitFSCursorOps) SetModTimestamp

func (o *DotGitFSCursorOps) SetModTimestamp(ctx context.Context, mtime time.Time) error

SetModTimestamp rejects or stages a timestamp change.

func (*DotGitFSCursorOps) SetPermissions

func (o *DotGitFSCursorOps) SetPermissions(ctx context.Context, permissions fs.FileMode, ts time.Time) error

SetPermissions rejects or stages a permission change.

func (o *DotGitFSCursorOps) Symlink(ctx context.Context, checkExist bool, name string, target []string, tgtIsAbsolute bool, ts time.Time) error

Symlink rejects or stages symlink creation.

func (*DotGitFSCursorOps) Truncate

func (o *DotGitFSCursorOps) Truncate(ctx context.Context, nsize uint64, ts time.Time) error

Truncate rejects or stages file truncation.

func (*DotGitFSCursorOps) WriteAt

func (o *DotGitFSCursorOps) WriteAt(ctx context.Context, offset int64, data []byte, ts time.Time) error

WriteAt rejects or stages file content bytes.

type DotGitFSCursorOption

type DotGitFSCursorOption func(*dotGitFSCursorOptions)

DotGitFSCursorOption configures a .git filesystem cursor.

func WithDotGitChangeSource

func WithDotGitChangeSource(changeSource DotGitFSCursorChangeSource) DotGitFSCursorOption

WithDotGitChangeSource configures the repo-level invalidation source.

func WithDotGitReleaseFn

func WithDotGitReleaseFn(releaseFn func()) DotGitFSCursorOption

WithDotGitReleaseFn configures cleanup called once when the cursor releases.

func WithDotGitWritable

func WithDotGitWritable(writable bool) DotGitFSCursorOption

WithDotGitWritable configures whether the .git cursor accepts write attempts.

type GitFSCursor

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

GitFSCursor implements unixfs.FSCursor backed by a go-git tree.

func NewGitFSCursor

func NewGitFSCursor(storer storer.EncodedObjectStorer, tree *object.Tree, name string) *GitFSCursor

NewGitFSCursor creates a new git-backed FSCursor for a directory. storer is the object storer for resolving hashes to objects. tree is the git tree object for this directory. name is the directory name (empty string for root).

func (*GitFSCursor) AddChangeCb

func (c *GitFSCursor) AddChangeCb(cb unixfs.FSCursorChangeCb)

AddChangeCb is a no-op (immutable tree never changes).

func (*GitFSCursor) CheckReleased

func (c *GitFSCursor) CheckReleased() bool

CheckReleased checks if the cursor is released.

func (*GitFSCursor) GetCursorOps

func (c *GitFSCursor) GetCursorOps(ctx context.Context) (unixfs.FSCursorOps, error)

GetCursorOps returns the FSCursorOps for this cursor.

func (*GitFSCursor) GetProxyCursor

func (c *GitFSCursor) GetProxyCursor(ctx context.Context) (unixfs.FSCursor, error)

GetProxyCursor returns nil, nil (no proxy needed for immutable data).

func (*GitFSCursor) Release

func (c *GitFSCursor) Release()

Release releases the cursor.

type GitFSCursorOps

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

GitFSCursorOps implements unixfs.FSCursorOps for git trees.

func (*GitFSCursorOps) CheckReleased

func (o *GitFSCursorOps) CheckReleased() bool

CheckReleased checks if the ops is released.

func (*GitFSCursorOps) CopyFrom

func (o *GitFSCursorOps) CopyFrom(ctx context.Context, name string, srcCursorOps unixfs.FSCursorOps, ts time.Time) (bool, error)

CopyFrom returns false, nil (not implemented).

func (*GitFSCursorOps) CopyTo

func (o *GitFSCursorOps) CopyTo(ctx context.Context, tgtDir unixfs.FSCursorOps, tgtName string, ts time.Time) (bool, error)

CopyTo returns false, nil (not implemented).

func (*GitFSCursorOps) GetIsDirectory

func (o *GitFSCursorOps) GetIsDirectory() bool

GetIsDirectory returns if the node is a directory.

func (*GitFSCursorOps) GetIsFile

func (o *GitFSCursorOps) GetIsFile() bool

GetIsFile returns if the node is a regular file.

func (o *GitFSCursorOps) GetIsSymlink() bool

GetIsSymlink returns if the node is a symlink.

func (*GitFSCursorOps) GetModTimestamp

func (o *GitFSCursorOps) GetModTimestamp(ctx context.Context) (time.Time, error)

GetModTimestamp returns the modification timestamp. Git trees do not have timestamps; returns zero time.

func (*GitFSCursorOps) GetName

func (o *GitFSCursorOps) GetName() string

GetName returns the name of the node.

func (*GitFSCursorOps) GetOptimalWriteSize

func (o *GitFSCursorOps) GetOptimalWriteSize(ctx context.Context) (int64, error)

GetOptimalWriteSize returns 0, ErrReadOnly.

func (*GitFSCursorOps) GetPermissions

func (o *GitFSCursorOps) GetPermissions(ctx context.Context) (fs.FileMode, error)

GetPermissions returns the file mode permissions.

func (*GitFSCursorOps) GetSize

func (o *GitFSCursorOps) GetSize(ctx context.Context) (uint64, error)

GetSize returns the size of the node in bytes.

func (*GitFSCursorOps) Lookup

func (o *GitFSCursorOps) Lookup(ctx context.Context, name string) (unixfs.FSCursor, error)

Lookup looks up a child entry in a directory.

func (*GitFSCursorOps) Mknod

func (o *GitFSCursorOps) Mknod(ctx context.Context, checkExist bool, names []string, nodeType unixfs.FSCursorNodeType, permissions fs.FileMode, ts time.Time) error

Mknod returns ErrReadOnly.

func (*GitFSCursorOps) MknodWithContent

func (o *GitFSCursorOps) MknodWithContent(ctx context.Context, name string, nodeType unixfs.FSCursorNodeType, dataLen int64, rdr io.Reader, permissions fs.FileMode, ts time.Time) error

MknodWithContent returns ErrReadOnly.

func (*GitFSCursorOps) MoveFrom

func (o *GitFSCursorOps) MoveFrom(ctx context.Context, name string, srcCursorOps unixfs.FSCursorOps, ts time.Time) (bool, error)

MoveFrom returns false, ErrReadOnly.

func (*GitFSCursorOps) MoveTo

func (o *GitFSCursorOps) MoveTo(ctx context.Context, tgtCursorOps unixfs.FSCursorOps, tgtName string, ts time.Time) (bool, error)

MoveTo returns false, ErrReadOnly.

func (*GitFSCursorOps) ReadAt

func (o *GitFSCursorOps) ReadAt(ctx context.Context, offset int64, data []byte) (int64, error)

ReadAt reads from a file node at the given offset.

func (*GitFSCursorOps) ReaddirAll

func (o *GitFSCursorOps) ReaddirAll(ctx context.Context, skip uint64, cb func(ent unixfs.FSCursorDirent) error) error

ReaddirAll reads all directory entries.

func (o *GitFSCursorOps) Readlink(ctx context.Context, name string) ([]string, bool, error)

Readlink reads a symbolic link's target. If name is empty, reads the link at the cursor position.

func (*GitFSCursorOps) Remove

func (o *GitFSCursorOps) Remove(ctx context.Context, names []string, ts time.Time) error

Remove returns ErrReadOnly.

func (*GitFSCursorOps) SetModTimestamp

func (o *GitFSCursorOps) SetModTimestamp(ctx context.Context, mtime time.Time) error

SetModTimestamp returns ErrReadOnly.

func (*GitFSCursorOps) SetPermissions

func (o *GitFSCursorOps) SetPermissions(ctx context.Context, permissions fs.FileMode, ts time.Time) error

SetPermissions returns ErrReadOnly.

func (o *GitFSCursorOps) Symlink(ctx context.Context, checkExist bool, name string, target []string, tgtIsAbsolute bool, ts time.Time) error

Symlink returns ErrReadOnly.

func (*GitFSCursorOps) Truncate

func (o *GitFSCursorOps) Truncate(ctx context.Context, nsize uint64, ts time.Time) error

Truncate returns ErrReadOnly.

func (*GitFSCursorOps) WriteAt

func (o *GitFSCursorOps) WriteAt(ctx context.Context, offset int64, data []byte, ts time.Time) error

WriteAt returns ErrReadOnly.

Jump to

Keyboard shortcuts

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