Documentation
¶
Overview ¶
Package unixfs_git implements a git-backed FSCursor.
Index ¶
- Variables
- type DotGitFSCursor
- func (c *DotGitFSCursor) AddChangeCb(cb unixfs.FSCursorChangeCb)
- func (c *DotGitFSCursor) CheckReleased() bool
- func (c *DotGitFSCursor) GetCursorOps(ctx context.Context) (unixfs.FSCursorOps, error)
- func (c *DotGitFSCursor) GetProxyCursor(ctx context.Context) (unixfs.FSCursor, error)
- func (c *DotGitFSCursor) Release()
- type DotGitFSCursorChangeSource
- type DotGitFSCursorOps
- func (o *DotGitFSCursorOps) CheckReleased() bool
- func (o *DotGitFSCursorOps) CopyFrom(ctx context.Context, name string, srcCursorOps unixfs.FSCursorOps, ...) (bool, error)
- func (o *DotGitFSCursorOps) CopyTo(ctx context.Context, tgtDir unixfs.FSCursorOps, tgtName string, ts time.Time) (bool, error)
- func (o *DotGitFSCursorOps) GetIsDirectory() bool
- func (o *DotGitFSCursorOps) GetIsFile() bool
- func (o *DotGitFSCursorOps) GetIsSymlink() bool
- func (o *DotGitFSCursorOps) GetModTimestamp(ctx context.Context) (time.Time, error)
- func (o *DotGitFSCursorOps) GetName() string
- func (o *DotGitFSCursorOps) GetOptimalWriteSize(ctx context.Context) (int64, error)
- func (o *DotGitFSCursorOps) GetPermissions(ctx context.Context) (fs.FileMode, error)
- func (o *DotGitFSCursorOps) GetSize(ctx context.Context) (uint64, error)
- func (o *DotGitFSCursorOps) Lookup(ctx context.Context, name string) (unixfs.FSCursor, error)
- func (o *DotGitFSCursorOps) Mknod(ctx context.Context, checkExist bool, names []string, ...) error
- func (o *DotGitFSCursorOps) MknodWithContent(ctx context.Context, name string, nodeType unixfs.FSCursorNodeType, ...) error
- func (o *DotGitFSCursorOps) MoveFrom(ctx context.Context, name string, srcCursorOps unixfs.FSCursorOps, ...) (bool, error)
- func (o *DotGitFSCursorOps) MoveTo(ctx context.Context, tgtCursorOps unixfs.FSCursorOps, tgtName string, ...) (bool, error)
- func (o *DotGitFSCursorOps) ReadAt(ctx context.Context, offset int64, data []byte) (int64, error)
- func (o *DotGitFSCursorOps) ReaddirAll(ctx context.Context, skip uint64, cb func(ent unixfs.FSCursorDirent) error) error
- func (o *DotGitFSCursorOps) Readlink(ctx context.Context, name string) ([]string, bool, error)
- func (o *DotGitFSCursorOps) Remove(ctx context.Context, names []string, ts time.Time) error
- func (o *DotGitFSCursorOps) SetModTimestamp(ctx context.Context, mtime time.Time) error
- func (o *DotGitFSCursorOps) SetPermissions(ctx context.Context, permissions fs.FileMode, ts time.Time) error
- func (o *DotGitFSCursorOps) Symlink(ctx context.Context, checkExist bool, name string, target []string, ...) error
- func (o *DotGitFSCursorOps) Truncate(ctx context.Context, nsize uint64, ts time.Time) error
- func (o *DotGitFSCursorOps) WriteAt(ctx context.Context, offset int64, data []byte, ts time.Time) error
- type DotGitFSCursorOption
- type GitFSCursor
- func (c *GitFSCursor) AddChangeCb(cb unixfs.FSCursorChangeCb)
- func (c *GitFSCursor) CheckReleased() bool
- func (c *GitFSCursor) GetCursorOps(ctx context.Context) (unixfs.FSCursorOps, error)
- func (c *GitFSCursor) GetProxyCursor(ctx context.Context) (unixfs.FSCursor, error)
- func (c *GitFSCursor) Release()
- type GitFSCursorOps
- func (o *GitFSCursorOps) CheckReleased() bool
- func (o *GitFSCursorOps) CopyFrom(ctx context.Context, name string, srcCursorOps unixfs.FSCursorOps, ...) (bool, error)
- func (o *GitFSCursorOps) CopyTo(ctx context.Context, tgtDir unixfs.FSCursorOps, tgtName string, ts time.Time) (bool, error)
- func (o *GitFSCursorOps) GetIsDirectory() bool
- func (o *GitFSCursorOps) GetIsFile() bool
- func (o *GitFSCursorOps) GetIsSymlink() bool
- func (o *GitFSCursorOps) GetModTimestamp(ctx context.Context) (time.Time, error)
- func (o *GitFSCursorOps) GetName() string
- func (o *GitFSCursorOps) GetOptimalWriteSize(ctx context.Context) (int64, error)
- func (o *GitFSCursorOps) GetPermissions(ctx context.Context) (fs.FileMode, error)
- func (o *GitFSCursorOps) GetSize(ctx context.Context) (uint64, error)
- func (o *GitFSCursorOps) Lookup(ctx context.Context, name string) (unixfs.FSCursor, error)
- func (o *GitFSCursorOps) Mknod(ctx context.Context, checkExist bool, names []string, ...) error
- func (o *GitFSCursorOps) MknodWithContent(ctx context.Context, name string, nodeType unixfs.FSCursorNodeType, ...) error
- func (o *GitFSCursorOps) MoveFrom(ctx context.Context, name string, srcCursorOps unixfs.FSCursorOps, ...) (bool, error)
- func (o *GitFSCursorOps) MoveTo(ctx context.Context, tgtCursorOps unixfs.FSCursorOps, tgtName string, ...) (bool, error)
- func (o *GitFSCursorOps) ReadAt(ctx context.Context, offset int64, data []byte) (int64, error)
- func (o *GitFSCursorOps) ReaddirAll(ctx context.Context, skip uint64, cb func(ent unixfs.FSCursorDirent) error) error
- func (o *GitFSCursorOps) Readlink(ctx context.Context, name string) ([]string, bool, error)
- func (o *GitFSCursorOps) Remove(ctx context.Context, names []string, ts time.Time) error
- func (o *GitFSCursorOps) SetModTimestamp(ctx context.Context, mtime time.Time) error
- func (o *GitFSCursorOps) SetPermissions(ctx context.Context, permissions fs.FileMode, ts time.Time) error
- func (o *GitFSCursorOps) Symlink(ctx context.Context, checkExist bool, name string, target []string, ...) error
- func (o *GitFSCursorOps) Truncate(ctx context.Context, nsize uint64, ts time.Time) error
- func (o *GitFSCursorOps) WriteAt(ctx context.Context, offset int64, data []byte, ts time.Time) error
Constants ¶
This section is empty.
Variables ¶
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 ¶
GetProxyCursor returns nil, nil because repository layout nodes do not proxy.
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 (*DotGitFSCursorOps) GetIsSymlink ¶
func (o *DotGitFSCursorOps) GetIsSymlink() bool
GetIsSymlink returns false because .git seed nodes are not symlinks.
func (*DotGitFSCursorOps) GetModTimestamp ¶
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 ¶
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) 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) ReaddirAll ¶
func (o *DotGitFSCursorOps) ReaddirAll(ctx context.Context, skip uint64, cb func(ent unixfs.FSCursorDirent) error) error
ReaddirAll reads all directory entries.
func (*DotGitFSCursorOps) SetModTimestamp ¶
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 (*DotGitFSCursorOps) Symlink ¶
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.
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 ¶
GetProxyCursor returns nil, nil (no proxy needed for immutable data).
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 (*GitFSCursorOps) GetIsSymlink ¶
func (o *GitFSCursorOps) GetIsSymlink() bool
GetIsSymlink returns if the node is a symlink.
func (*GitFSCursorOps) GetModTimestamp ¶
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 ¶
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) 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) ReaddirAll ¶
func (o *GitFSCursorOps) ReaddirAll(ctx context.Context, skip uint64, cb func(ent unixfs.FSCursorDirent) error) error
ReaddirAll reads all directory entries.
func (*GitFSCursorOps) Readlink ¶
Readlink reads a symbolic link's target. If name is empty, reads the link at the cursor position.
func (*GitFSCursorOps) SetModTimestamp ¶
SetModTimestamp returns ErrReadOnly.
func (*GitFSCursorOps) SetPermissions ¶
func (o *GitFSCursorOps) SetPermissions(ctx context.Context, permissions fs.FileMode, ts time.Time) error
SetPermissions returns ErrReadOnly.
func (*GitFSCursorOps) Symlink ¶
func (o *GitFSCursorOps) Symlink(ctx context.Context, checkExist bool, name string, target []string, tgtIsAbsolute bool, ts time.Time) error
Symlink returns ErrReadOnly.