filebase

package
v0.0.0-...-7899014 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotDir = errors.New("not a dir")

Functions

func TestContent

func TestContent(
	t *testing.T,
	scope Scope,
	wg *pr2.WaitGroup,
)

func TestContentSB

func TestContentSB(t *testing.T)

Types

type ChunkThreshold

type ChunkThreshold int64

type Content

type Content []byte

func (Content) MarshalSB

func (c Content) MarshalSB(ctx sb.Ctx, cont sb.Proc) sb.Proc

func (*Content) UnmarshalSB

func (c *Content) UnmarshalSB(ctx sb.Ctx, cont sb.Sink) sb.Sink

type ContentReader

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

func (*ContentReader) Read

func (c *ContentReader) Read(buf []byte) (_ int, err error)

func (*ContentReader) Seek

func (c *ContentReader) Seek(offset int64, whence int) (_ int64, err error)

type Def

type Def struct{}

func (Def) ChunkArgs

func (_ Def) ChunkArgs() (ChunkThreshold, MaxChunkSize)

func (Def) Funcs

func (_ Def) Funcs(
	fetch entity.Fetch,
	newContentReader NewContentReader,
	newHashState key.NewHashState,
) (
	iterSubs IterSubs,
	findFileInSubs FindFileInSubs,
)

func (Def) NewContentReader

func (_ Def) NewContentReader(
	fetch entity.Fetch,
) NewContentReader

func (Def) NewFileFS

func (_ Def) NewFileFS(
	iterSubs IterSubs,
	newContentReadre NewContentReader,
	findFileInSubs FindFileInSubs,
) NewFileFS

func (Def) ToContents

func (_ Def) ToContents(
	save entity.SaveEntity,
	chunkThreshold ChunkThreshold,
	maxChunkSize MaxChunkSize,
) ToContents

func (Def) WriteContents

func (_ Def) WriteContents(
	fetch entity.Fetch,
) WriteContents

type DirEntry

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

func (DirEntry) Info

func (e DirEntry) Info() (fs.FileInfo, error)

func (DirEntry) IsDir

func (e DirEntry) IsDir() bool

func (DirEntry) Name

func (e DirEntry) Name() string

func (DirEntry) Type

func (e DirEntry) Type() fs.FileMode

type FS

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

func (*FS) Open

func (f *FS) Open(name string) (_ fs.File, err error)

type File

type File struct {
	ModTime      time.Time
	Name         string
	Subs         Subs
	Contents     []Key
	ChunkLengths []int64
	ContentBytes []byte
	Size         int64
	Mode         os.FileMode
	IsDir        bool
}

func (*File) GetDevice

func (f *File) GetDevice(_ Scope) uint64

func (*File) GetIsDir

func (f *File) GetIsDir(_ Scope) bool

func (*File) GetModTime

func (f *File) GetModTime(_ Scope) time.Time

func (*File) GetMode

func (f *File) GetMode(_ Scope) os.FileMode

func (*File) GetName

func (f *File) GetName(_ Scope) string

func (*File) GetSize

func (f *File) GetSize(_ Scope) int64

func (*File) GetTreeSize

func (f *File) GetTreeSize(scope Scope) int64

func (*File) GetWeight

func (f *File) GetWeight(scope Scope) int

func (File) MarshalSB

func (f File) MarshalSB(ctx sb.Ctx, cont sb.Proc) sb.Proc

func (*File) WithReader

func (f *File) WithReader(scope Scope, fn func(io.Reader) error) (err error)

type FindFileInSubs

type FindFileInSubs func(subs Subs, parts []string) (*File, error)

type Handle

type Handle struct {
	io.ReadSeeker
	// contains filtered or unexported fields
}

func (*Handle) Close

func (h *Handle) Close() error

func (*Handle) ReadDir

func (h *Handle) ReadDir(n int) (ret []fs.DirEntry, err error)

func (*Handle) Stat

func (h *Handle) Stat() (fs.FileInfo, error)

type Info

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

func (Info) IsDir

func (i Info) IsDir() bool

func (Info) ModTime

func (i Info) ModTime() time.Time

func (Info) Mode

func (i Info) Mode() fs.FileMode

func (Info) Name

func (i Info) Name() string

func (Info) Size

func (i Info) Size() int64

func (Info) Sys

func (i Info) Sys() any

type IterSubs

type IterSubs func(subs Subs, cont pp.Src) pp.Src

type Key

type Key = key.Key

type MaxChunkSize

type MaxChunkSize int64

type NewContentReader

type NewContentReader func(
	keys []Key,
	lengths []int64,
) *ContentReader

type NewFileFS

type NewFileFS func(file *File) (fs.FS, error)

type Pack

type Pack struct {
	Min    string
	Max    string
	Size   int64
	Height int
	Key    Key // key of Subs
}

type Scope

type Scope = dscope.Scope

type Sub

type Sub struct {
	File *File
	Pack *Pack
}

func (Sub) MarshalSB

func (s Sub) MarshalSB(ctx sb.Ctx, cont sb.Proc) sb.Proc

func (*Sub) UnmarshalSB

func (s *Sub) UnmarshalSB(ctx sb.Ctx, cont sb.Sink) sb.Sink

type Subs

type Subs []Sub

type ToContents

type ToContents func(
	ctx context.Context,
	r io.Reader,
	size int64,
) (
	keys []Key,
	lengths []int64,
	err error,
)

type WriteContents

type WriteContents func(
	keys []Key,
	w io.Writer,
) (
	err error,
)

Jump to

Keyboard shortcuts

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