filesystem

package
v0.0.0-...-29af9ac Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthEntry        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowEntry          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupEntry = fmt.Errorf("proto: unexpected end of group")
)
View Source
var EntryType_name = map[int32]string{
	0: "ENTRY_TYPE_UNKNOWN",
	1: "ENTRY_TYPE_FILE",
	2: "ENTRY_TYPE_DIR",
}
View Source
var EntryType_value = map[string]int32{
	"ENTRY_TYPE_UNKNOWN": 0,
	"ENTRY_TYPE_FILE":    1,
	"ENTRY_TYPE_DIR":     2,
}

Functions

func PathExists

func PathExists(path string) bool

Types

type BaseFile

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

func (*BaseFile) Close

func (f *BaseFile) Close() error

func (*BaseFile) CurrentSeek

func (f *BaseFile) CurrentSeek() (int64, error)

func (*BaseFile) File

func (f *BaseFile) File() *os.File

func (*BaseFile) MD5

func (f *BaseFile) MD5() ([]byte, error)

func (*BaseFile) Name

func (f *BaseFile) Name() string

func (*BaseFile) Read

func (f *BaseFile) Read(p []byte) (n int, err error)

func (*BaseFile) ReadFileAtOffset

func (f *BaseFile) ReadFileAtOffset(offset int64, length int64) ([]byte, error)

func (*BaseFile) Seek

func (f *BaseFile) Seek(offset int64, whence int) (n int64, err error)

func (*BaseFile) Stat

func (f *BaseFile) Stat() (os.FileInfo, error)

func (*BaseFile) Update

func (f *BaseFile) Update(from File)

func (*BaseFile) Write

func (f *BaseFile) Write(p []byte) (n int, err error)

type BasicFileSystem

type BasicFileSystem struct{}

func (*BasicFileSystem) CreateFile

func (f *BasicFileSystem) CreateFile(path string) (File, error)

func (*BasicFileSystem) List

func (f *BasicFileSystem) List(path string) (entries []*Entry, err error)

func (*BasicFileSystem) OpenFile

func (f *BasicFileSystem) OpenFile(path string) (File, error)

func (*BasicFileSystem) Walk

func (f *BasicFileSystem) Walk(path string, filter WalkFilter) (entries []*Entry, err error)

func (*BasicFileSystem) WalkIter

func (f *BasicFileSystem) WalkIter(root string, filter WalkFilter) (iter.Seq[*Entry], error)

type Entry

type Entry struct {
	Name         string    `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty" yaml:"-"`
	Type         EntryType `protobuf:"varint,2,opt,name=type,proto3,enum=filesystem.EntryType" json:"type,omitempty" yaml:"-"`
	Size         int64     `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty" yaml:"-"`
	Path         string    `protobuf:"bytes,4,opt,name=path,proto3" json:"path,omitempty" yaml:"-"`
	Wpath        string    `protobuf:"bytes,5,opt,name=wpath,proto3" json:"wpath,omitempty" yaml:"-"`
	CreatedTime  string    `protobuf:"bytes,6,opt,name=created_time,json=createdTime,proto3" json:"created_time,omitempty" yaml:"-"`
	ModifiedTime string    `protobuf:"bytes,7,opt,name=modified_time,json=modifiedTime,proto3" json:"modified_time,omitempty" yaml:"-"`
	AccessedTime string    `protobuf:"bytes,8,opt,name=accessed_time,json=accessedTime,proto3" json:"accessed_time,omitempty" yaml:"-"`
	Owner        string    `protobuf:"bytes,9,opt,name=owner,proto3" json:"owner,omitempty" yaml:"-"`
	Permissions  string    `protobuf:"bytes,10,opt,name=permissions,proto3" json:"permissions,omitempty" yaml:"-"`
	Regular      bool      `protobuf:"varint,11,opt,name=regular,proto3" json:"regular" yaml:"-"`
	Children     []*Entry  `protobuf:"bytes,12,rep,name=children,proto3" json:"children,omitempty" yaml:"-"`
}

func (*Entry) Descriptor

func (*Entry) Descriptor() ([]byte, []int)

func (*Entry) GetAccessedTime

func (m *Entry) GetAccessedTime() string

func (*Entry) GetChildren

func (m *Entry) GetChildren() []*Entry

func (*Entry) GetCreatedTime

func (m *Entry) GetCreatedTime() string

func (*Entry) GetModifiedTime

func (m *Entry) GetModifiedTime() string

func (*Entry) GetName

func (m *Entry) GetName() string

func (*Entry) GetOwner

func (m *Entry) GetOwner() string

func (*Entry) GetPath

func (m *Entry) GetPath() string

func (*Entry) GetPermissions

func (m *Entry) GetPermissions() string

func (*Entry) GetRegular

func (m *Entry) GetRegular() bool

func (*Entry) GetSize

func (m *Entry) GetSize() int64

func (*Entry) GetType

func (m *Entry) GetType() EntryType

func (*Entry) GetWpath

func (m *Entry) GetWpath() string

func (*Entry) IsDir

func (e *Entry) IsDir() bool

func (*Entry) Marshal

func (m *Entry) Marshal() (dAtA []byte, err error)

func (*Entry) MarshalTo

func (m *Entry) MarshalTo(dAtA []byte) (int, error)

func (*Entry) MarshalToSizedBuffer

func (m *Entry) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Entry) ProtoMessage

func (*Entry) ProtoMessage()

func (*Entry) ProtoSize

func (m *Entry) ProtoSize() (n int)

func (*Entry) Reset

func (m *Entry) Reset()

func (*Entry) String

func (m *Entry) String() string

func (*Entry) Unmarshal

func (m *Entry) Unmarshal(dAtA []byte) error

func (*Entry) XXX_DiscardUnknown

func (m *Entry) XXX_DiscardUnknown()

func (*Entry) XXX_Marshal

func (m *Entry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Entry) XXX_Merge

func (m *Entry) XXX_Merge(src proto.Message)

func (*Entry) XXX_Size

func (m *Entry) XXX_Size() int

func (*Entry) XXX_Unmarshal

func (m *Entry) XXX_Unmarshal(b []byte) error

type EntryType

type EntryType int32
const (
	EntryTypeUnknown EntryType = 0
	EntryTypeFile    EntryType = 1
	EntryTypeDir     EntryType = 2
)

func GetEntryType

func GetEntryType(isDir bool) EntryType

func (EntryType) EnumDescriptor

func (EntryType) EnumDescriptor() ([]byte, []int)

func (EntryType) String

func (x EntryType) String() string

type File

type File interface {
	File() *os.File
	Name() string
	Stat() (os.FileInfo, error)
	Read(p []byte) (n int, err error)
	Write(p []byte) (n int, err error)
	Seek(offset int64, whence int) (n int64, err error)
	Update(from File)
	CurrentSeek() (int64, error)
	MD5() ([]byte, error)
	ReadFileAtOffset(offset int64, length int64) ([]byte, error)
	Close() error
}

type FileSystem

type FileSystem interface {
	List(path string) ([]*Entry, error)
	Walk(path string, filter WalkFilter) ([]*Entry, error)
	WalkIter(path string, filter WalkFilter) (iter.Seq[*Entry], error)
	OpenFile(path string) (File, error)
	CreateFile(path string) (File, error)
}

func NewBasicFileSystem

func NewBasicFileSystem() FileSystem

type ListResp

type ListResp struct {
	Entries []*Entry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries" yaml:"-"`
}

func (*ListResp) Descriptor

func (*ListResp) Descriptor() ([]byte, []int)

func (*ListResp) GetEntries

func (m *ListResp) GetEntries() []*Entry

func (*ListResp) Marshal

func (m *ListResp) Marshal() (dAtA []byte, err error)

func (*ListResp) MarshalTo

func (m *ListResp) MarshalTo(dAtA []byte) (int, error)

func (*ListResp) MarshalToSizedBuffer

func (m *ListResp) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ListResp) ProtoMessage

func (*ListResp) ProtoMessage()

func (*ListResp) ProtoSize

func (m *ListResp) ProtoSize() (n int)

func (*ListResp) Reset

func (m *ListResp) Reset()

func (*ListResp) String

func (m *ListResp) String() string

func (*ListResp) Unmarshal

func (m *ListResp) Unmarshal(dAtA []byte) error

func (*ListResp) XXX_DiscardUnknown

func (m *ListResp) XXX_DiscardUnknown()

func (*ListResp) XXX_Marshal

func (m *ListResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ListResp) XXX_Merge

func (m *ListResp) XXX_Merge(src proto.Message)

func (*ListResp) XXX_Size

func (m *ListResp) XXX_Size() int

func (*ListResp) XXX_Unmarshal

func (m *ListResp) XXX_Unmarshal(b []byte) error

type WalkFilter

type WalkFilter func(path string, info fs.FileInfo) bool

Jump to

Keyboard shortcuts

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