Documentation
¶
Index ¶
- Variables
- func LifetimeSorter(a, b *Lifetime) int
- func MoveFileBetweenTrees(file, newParent *WeblensFileImpl, newName string, oldTree, newTree FileTree, ...) error
- type FileAction
- func (fa *FileAction) GetActionType() FileActionType
- func (fa *FileAction) GetDestinationPath() string
- func (fa *FileAction) GetFile() *WeblensFileImpl
- func (fa *FileAction) GetLifetimeId() FileId
- func (fa *FileAction) GetOriginPath() string
- func (fa *FileAction) GetParentId() FileId
- func (fa *FileAction) GetRelevantPath() string
- func (fa *FileAction) GetSize() int64
- func (fa *FileAction) GetTimestamp() time.Time
- func (fa *FileAction) SetLifetimeId(lId FileId)
- func (fa *FileAction) SetSize(size int64)
- type FileActionType
- type FileEvent
- func (fe *FileEvent) GetActions() []*FileAction
- func (fe *FileEvent) GetEventId() FileEventId
- func (fe *FileEvent) NewCreateAction(file *WeblensFileImpl) *FileAction
- func (fe *FileEvent) NewDeleteAction(lifeId FileId) *FileAction
- func (fe *FileEvent) NewMoveAction(lifeId FileId, file *WeblensFileImpl) *FileAction
- func (fe *FileEvent) NewRestoreAction(file *WeblensFileImpl) *FileAction
- func (fe *FileEvent) NewSizeChangeAction(file *WeblensFileImpl) *FileAction
- func (fe *FileEvent) Wait()
- type FileEventId
- type FileId
- type FileTree
- type FileTreeImpl
- func (ft *FileTreeImpl) AbsToPortable(absPath string) (WeblensFilepath, error)
- func (ft *FileTreeImpl) Add(f *WeblensFileImpl) error
- func (ft *FileTreeImpl) Delete(id FileId, event *FileEvent) error
- func (ft *FileTreeImpl) GenerateFileId() FileId
- func (ft *FileTreeImpl) Get(fileId FileId) *WeblensFileImpl
- func (ft *FileTreeImpl) GetJournal() Journal
- func (ft *FileTreeImpl) GetRoot() *WeblensFileImpl
- func (ft *FileTreeImpl) MkDir(parentFolder *WeblensFileImpl, newDirName string, event *FileEvent) (*WeblensFileImpl, error)
- func (ft *FileTreeImpl) Move(f, newParent *WeblensFileImpl, newFilename string, overwrite bool, ...) ([]MoveInfo, error)
- func (ft *FileTreeImpl) PortableToAbs(portable WeblensFilepath) (string, error)
- func (ft *FileTreeImpl) ReadDir(dir *WeblensFileImpl) ([]*WeblensFileImpl, error)
- func (ft *FileTreeImpl) Remove(id FileId) ([]*WeblensFileImpl, error)
- func (ft *FileTreeImpl) ReplaceId(existingId, newId FileId) error
- func (ft *FileTreeImpl) ResizeDown(anchor *WeblensFileImpl, event *FileEvent, ...) error
- func (ft *FileTreeImpl) ResizeUp(anchor *WeblensFileImpl, event *FileEvent, ...) error
- func (ft *FileTreeImpl) SetJournal(j Journal)
- func (ft *FileTreeImpl) SetRootAlias(alias string) error
- func (ft *FileTreeImpl) Size() int
- func (ft *FileTreeImpl) Touch(parentFolder *WeblensFileImpl, newFileName string, event *FileEvent) (*WeblensFileImpl, error)
- type HashWaiter
- type Hasher
- type Journal
- type JournalImpl
- func (j *JournalImpl) Add(lts ...*Lifetime) error
- func (j *JournalImpl) Clear() error
- func (j *JournalImpl) Close()
- func (j *JournalImpl) EventWorker()
- func (j *JournalImpl) FileWatcher()
- func (j *JournalImpl) Flush()
- func (j *JournalImpl) Get(lId FileId) *Lifetime
- func (j *JournalImpl) GetActionsByPath(path WeblensFilepath) ([]*FileAction, error)
- func (j *JournalImpl) GetActiveLifetimes() []*Lifetime
- func (j *JournalImpl) GetAllLifetimes() []*Lifetime
- func (j *JournalImpl) GetLatestAction() (*FileAction, error)
- func (j *JournalImpl) GetLifetimesSince(date time.Time) ([]*Lifetime, error)
- func (j *JournalImpl) GetPastFile(id FileId, time time.Time) (*WeblensFileImpl, error)
- func (j *JournalImpl) GetPastFolderChildren(folder *WeblensFileImpl, time time.Time) ([]*WeblensFileImpl, error)
- func (j *JournalImpl) IgnoreLocal() bool
- func (j *JournalImpl) LogEvent(fe *FileEvent)
- func (j *JournalImpl) NewEvent() *FileEvent
- func (j *JournalImpl) SetFileTree(ft *FileTreeImpl)
- func (j *JournalImpl) SetIgnoreLocal(ignore bool)
- func (j *JournalImpl) UpdateLifetime(lifetime *Lifetime) error
- func (j *JournalImpl) WatchFolder(f *WeblensFileImpl) error
- type Lifetime
- func (l *Lifetime) Add(action *FileAction)
- func (l *Lifetime) GetActions() []*FileAction
- func (l *Lifetime) GetContentId() string
- func (l *Lifetime) GetIsDir() bool
- func (l *Lifetime) GetLatestAction() *FileAction
- func (l *Lifetime) GetLatestMove() *FileAction
- func (l *Lifetime) GetLatestPath() WeblensFilepath
- func (l *Lifetime) GetLatestSize() int64
- func (l *Lifetime) HasEvent(eventId FileEventId) bool
- func (l *Lifetime) ID() FileId
- func (l *Lifetime) IsLive() bool
- func (l *Lifetime) SetContentId(cId string)
- type MoveInfo
- type WeblensFile
- type WeblensFileImpl
- func (f *WeblensFileImpl) AbsPath() string
- func (f *WeblensFileImpl) AddChild(child *WeblensFileImpl) error
- func (f *WeblensFileImpl) Append(data []byte) error
- func (f *WeblensFileImpl) BubbleMap(fn func(*WeblensFileImpl) error) error
- func (f *WeblensFileImpl) Close() error
- func (f *WeblensFileImpl) CreateSelf() error
- func (f *WeblensFileImpl) Exists() bool
- func (f *WeblensFileImpl) Filename() string
- func (f *WeblensFileImpl) Freeze() *WeblensFileImpl
- func (f *WeblensFileImpl) GetChild(childName string) (*WeblensFileImpl, error)
- func (f *WeblensFileImpl) GetChildren() []*WeblensFileImpl
- func (f *WeblensFileImpl) GetContentId() string
- func (f *WeblensFileImpl) GetParent() *WeblensFileImpl
- func (f *WeblensFileImpl) GetParentId() FileId
- func (f *WeblensFileImpl) GetPastId() FileId
- func (f *WeblensFileImpl) GetPortablePath() WeblensFilepath
- func (f *WeblensFileImpl) ID() FileId
- func (f *WeblensFileImpl) IsDir() bool
- func (f *WeblensFileImpl) IsParentOf(child *WeblensFileImpl) bool
- func (f *WeblensFileImpl) IsReadOnly() bool
- func (f *WeblensFileImpl) LeafMap(fn func(*WeblensFileImpl) error) error
- func (f *WeblensFileImpl) LoadStat() (newSize int64, err error)
- func (f *WeblensFileImpl) MarshalJSON() ([]byte, error)
- func (f *WeblensFileImpl) ModTime() (t time.Time)
- func (f *WeblensFileImpl) Mode() os.FileMode
- func (f *WeblensFileImpl) Name() string
- func (f *WeblensFileImpl) Read(p []byte) (n int, err error)
- func (f *WeblensFileImpl) ReadAll() ([]byte, error)
- func (f *WeblensFileImpl) Readable() (io.Reader, error)
- func (f *WeblensFileImpl) Readdir(count int) ([]fs.FileInfo, error)
- func (f *WeblensFileImpl) RecursiveMap(fn func(*WeblensFileImpl) error) error
- func (f *WeblensFileImpl) ReplaceRoot(newRoot string)
- func (f *WeblensFileImpl) Seek(offset int64, whence int) (int64, error)
- func (f *WeblensFileImpl) SetContentId(newContentId string)
- func (f *WeblensFileImpl) SetMemOnly(memOnly bool)
- func (f *WeblensFileImpl) SetSize(newSize int64)
- func (f *WeblensFileImpl) SetWatching() error
- func (f *WeblensFileImpl) Size() int64
- func (f *WeblensFileImpl) Stat() (fs.FileInfo, error)
- func (f *WeblensFileImpl) Sys() any
- func (f *WeblensFileImpl) UnmarshalJSON(bs []byte) error
- func (f *WeblensFileImpl) WithLock(fn func() error) error
- func (f *WeblensFileImpl) Write(data []byte) (int, error)
- func (f *WeblensFileImpl) WriteAt(data []byte, seekLoc int64) error
- func (f *WeblensFileImpl) Writeable() (*os.File, error)
- type WeblensFilepath
- func (wf WeblensFilepath) Child(childName string, childIsDir bool) WeblensFilepath
- func (wf WeblensFilepath) Dir() WeblensFilepath
- func (wf WeblensFilepath) Filename() string
- func (wf WeblensFilepath) IsDir() bool
- func (wf WeblensFilepath) OverwriteRoot(newRoot string) WeblensFilepath
- func (wf WeblensFilepath) RelativePath() string
- func (wf WeblensFilepath) RootName() string
- func (wf WeblensFilepath) String() string
- func (wf WeblensFilepath) ToPortable() string
Constants ¶
This section is empty.
Variables ¶
var IgnoreFilenames = []string{
".DS_Store",
".content",
}
Functions ¶
func LifetimeSorter ¶
func MoveFileBetweenTrees ¶
func MoveFileBetweenTrees( file, newParent *WeblensFileImpl, newName string, oldTree, newTree FileTree, event *FileEvent, ) error
Types ¶
type FileAction ¶
type FileAction struct { Timestamp time.Time `json:"timestamp" bson:"timestamp"` ActionType FileActionType `json:"actionType" bson:"actionType"` OriginPath string `json:"originPath" bson:"originPath,omitempty"` DestinationPath string `json:"destinationPath" bson:"destinationPath,omitempty"` LifeId FileId `json:"lifeId" bson:"lifeId"` EventId FileEventId `json:"eventId" bson:"eventId"` ParentId FileId `json:"parentId" bson:"parentId"` ServerId string `json:"serverId" bson:"serverId"` Size int64 `json:"size" bson:"size"` // contains filtered or unexported fields }
func (*FileAction) GetActionType ¶
func (fa *FileAction) GetActionType() FileActionType
func (*FileAction) GetDestinationPath ¶
func (fa *FileAction) GetDestinationPath() string
func (*FileAction) GetFile ¶
func (fa *FileAction) GetFile() *WeblensFileImpl
func (*FileAction) GetLifetimeId ¶
func (fa *FileAction) GetLifetimeId() FileId
func (*FileAction) GetOriginPath ¶
func (fa *FileAction) GetOriginPath() string
func (*FileAction) GetParentId ¶
func (fa *FileAction) GetParentId() FileId
func (*FileAction) GetRelevantPath ¶
func (fa *FileAction) GetRelevantPath() string
func (*FileAction) GetSize ¶
func (fa *FileAction) GetSize() int64
func (*FileAction) GetTimestamp ¶
func (fa *FileAction) GetTimestamp() time.Time
func (*FileAction) SetLifetimeId ¶
func (fa *FileAction) SetLifetimeId(lId FileId)
func (*FileAction) SetSize ¶
func (fa *FileAction) SetSize(size int64)
type FileActionType ¶
type FileActionType = string
const ( FileCreate FileActionType = "fileCreate" FileMove FileActionType = "fileMove" FileSizeChange FileActionType = "fileSizeChange" Backup FileActionType = "backup" FileDelete FileActionType = "fileDelete" FileRestore FileActionType = "fileRestore" )
type FileEvent ¶
type FileEvent struct { EventBegin time.Time `bson:"eventBegin"` // LoggedChan is used to signal that the event has been logged to the journal. // This is used to prevent actions on the same lifetime to be logged out of order. // LoggedChan does not get written to, it is only closed. LoggedChan chan struct{} `bson:"-"` EventId FileEventId `bson:"_id"` ServerId string `bson:"serverId"` Actions []*FileAction `bson:"actions"` Logged atomic.Bool `bson:"-"` // contains filtered or unexported fields }
func (*FileEvent) GetActions ¶
func (fe *FileEvent) GetActions() []*FileAction
func (*FileEvent) GetEventId ¶
func (fe *FileEvent) GetEventId() FileEventId
func (*FileEvent) NewCreateAction ¶
func (fe *FileEvent) NewCreateAction(file *WeblensFileImpl) *FileAction
func (*FileEvent) NewDeleteAction ¶
func (fe *FileEvent) NewDeleteAction(lifeId FileId) *FileAction
func (*FileEvent) NewMoveAction ¶
func (fe *FileEvent) NewMoveAction(lifeId FileId, file *WeblensFileImpl) *FileAction
func (*FileEvent) NewRestoreAction ¶
func (fe *FileEvent) NewRestoreAction(file *WeblensFileImpl) *FileAction
func (*FileEvent) NewSizeChangeAction ¶
func (fe *FileEvent) NewSizeChangeAction(file *WeblensFileImpl) *FileAction
type FileEventId ¶
type FileEventId = string
type FileTree ¶
type FileTree interface { Get(id FileId) *WeblensFileImpl GetRoot() *WeblensFileImpl ReadDir(dir *WeblensFileImpl) ([]*WeblensFileImpl, error) Size() int GetJournal() Journal SetJournal(Journal) Add(file *WeblensFileImpl) error Remove(id FileId) ([]*WeblensFileImpl, error) Delete(id FileId, event *FileEvent) error Move(f, newParent *WeblensFileImpl, newFilename string, overwrite bool, event *FileEvent) ([]MoveInfo, error) Touch(parentFolder *WeblensFileImpl, newFileName string, event *FileEvent) (*WeblensFileImpl, error) MkDir(parentFolder *WeblensFileImpl, newDirName string, event *FileEvent) (*WeblensFileImpl, error) SetRootAlias(alias string) error ReplaceId(oldId, newId FileId) error PortableToAbs(portable WeblensFilepath) (string, error) AbsToPortable(absPath string) (WeblensFilepath, error) GenerateFileId() FileId ResizeUp(anchor *WeblensFileImpl, event *FileEvent, updateCallback func(newFile *WeblensFileImpl)) error ResizeDown(anchor *WeblensFileImpl, event *FileEvent, updateCallback func(newFile *WeblensFileImpl)) error }
type FileTreeImpl ¶
type FileTreeImpl struct {
// contains filtered or unexported fields
}
func (*FileTreeImpl) AbsToPortable ¶
func (ft *FileTreeImpl) AbsToPortable(absPath string) (WeblensFilepath, error)
func (*FileTreeImpl) Add ¶
func (ft *FileTreeImpl) Add(f *WeblensFileImpl) error
func (*FileTreeImpl) GenerateFileId ¶
func (ft *FileTreeImpl) GenerateFileId() FileId
func (*FileTreeImpl) Get ¶
func (ft *FileTreeImpl) Get(fileId FileId) *WeblensFileImpl
func (*FileTreeImpl) GetJournal ¶
func (ft *FileTreeImpl) GetJournal() Journal
func (*FileTreeImpl) GetRoot ¶
func (ft *FileTreeImpl) GetRoot() *WeblensFileImpl
func (*FileTreeImpl) MkDir ¶
func (ft *FileTreeImpl) MkDir( parentFolder *WeblensFileImpl, newDirName string, event *FileEvent, ) (*WeblensFileImpl, error)
MkDir creates a new dir as a child of parentFolder named newDirName. If the dir already exists, it will be returned along with a ErrDirAlreadyExists error.
func (*FileTreeImpl) Move ¶
func (ft *FileTreeImpl) Move( f, newParent *WeblensFileImpl, newFilename string, overwrite bool, event *FileEvent, ) ([]MoveInfo, error)
func (*FileTreeImpl) PortableToAbs ¶
func (ft *FileTreeImpl) PortableToAbs(portable WeblensFilepath) (string, error)
func (*FileTreeImpl) ReadDir ¶
func (ft *FileTreeImpl) ReadDir(dir *WeblensFileImpl) ([]*WeblensFileImpl, error)
ReadDir reads the filesystem for files it does not yet have, adds them to the tree, and returns the newly added files
func (*FileTreeImpl) Remove ¶
func (ft *FileTreeImpl) Remove(id FileId) ([]*WeblensFileImpl, error)
func (*FileTreeImpl) ReplaceId ¶
func (ft *FileTreeImpl) ReplaceId(existingId, newId FileId) error
func (*FileTreeImpl) ResizeDown ¶
func (ft *FileTreeImpl) ResizeDown(anchor *WeblensFileImpl, event *FileEvent, updateCallback func(newFile *WeblensFileImpl)) error
func (*FileTreeImpl) ResizeUp ¶
func (ft *FileTreeImpl) ResizeUp(anchor *WeblensFileImpl, event *FileEvent, updateCallback func(newFile *WeblensFileImpl)) error
func (*FileTreeImpl) SetJournal ¶
func (ft *FileTreeImpl) SetJournal(j Journal)
func (*FileTreeImpl) SetRootAlias ¶
func (ft *FileTreeImpl) SetRootAlias(alias string) error
func (*FileTreeImpl) Size ¶
func (ft *FileTreeImpl) Size() int
Size gets the number of files loaded into weblens. This does not lock the file tree, and therefore cannot be trusted to be microsecond accurate, but it's quite close
func (*FileTreeImpl) Touch ¶
func (ft *FileTreeImpl) Touch(parentFolder *WeblensFileImpl, newFileName string, event *FileEvent) ( *WeblensFileImpl, error, )
type HashWaiter ¶
type HashWaiter interface { Hasher Wait() }
type Hasher ¶
type Hasher interface {
Hash(file *WeblensFileImpl) error
}
type Journal ¶
type Journal interface { Get(id FileId) *Lifetime Add(lifetime ...*Lifetime) error SetFileTree(ft *FileTreeImpl) IgnoreLocal() bool SetIgnoreLocal(ignore bool) NewEvent() *FileEvent WatchFolder(f *WeblensFileImpl) error LogEvent(fe *FileEvent) Flush() GetPastFile(id FileId, time time.Time) (*WeblensFileImpl, error) GetActionsByPath(WeblensFilepath) ([]*FileAction, error) GetPastFolderChildren(folder *WeblensFileImpl, time time.Time) ([]*WeblensFileImpl, error) GetLatestAction() (*FileAction, error) GetLifetimesSince(date time.Time) ([]*Lifetime, error) UpdateLifetime(lifetime *Lifetime) error EventWorker() FileWatcher() GetActiveLifetimes() []*Lifetime GetAllLifetimes() []*Lifetime Clear() error }
type JournalImpl ¶
type JournalImpl struct {
// contains filtered or unexported fields
}
func NewJournal ¶
func NewJournal(col *mongo.Collection, serverId string, ignoreLocal bool, hasherFactory func() Hasher, logger log.Bundle) ( *JournalImpl, error, )
func (*JournalImpl) Add ¶
func (j *JournalImpl) Add(lts ...*Lifetime) error
func (*JournalImpl) Clear ¶
func (j *JournalImpl) Clear() error
func (*JournalImpl) Close ¶
func (j *JournalImpl) Close()
func (*JournalImpl) EventWorker ¶
func (j *JournalImpl) EventWorker()
func (*JournalImpl) FileWatcher ¶
func (j *JournalImpl) FileWatcher()
func (*JournalImpl) Flush ¶
func (j *JournalImpl) Flush()
func (*JournalImpl) Get ¶
func (j *JournalImpl) Get(lId FileId) *Lifetime
func (*JournalImpl) GetActionsByPath ¶
func (j *JournalImpl) GetActionsByPath(path WeblensFilepath) ([]*FileAction, error)
func (*JournalImpl) GetActiveLifetimes ¶
func (j *JournalImpl) GetActiveLifetimes() []*Lifetime
func (*JournalImpl) GetAllLifetimes ¶
func (j *JournalImpl) GetAllLifetimes() []*Lifetime
func (*JournalImpl) GetLatestAction ¶
func (j *JournalImpl) GetLatestAction() (*FileAction, error)
func (*JournalImpl) GetLifetimesSince ¶
func (j *JournalImpl) GetLifetimesSince(date time.Time) ([]*Lifetime, error)
func (*JournalImpl) GetPastFile ¶
func (j *JournalImpl) GetPastFile(id FileId, time time.Time) (*WeblensFileImpl, error)
func (*JournalImpl) GetPastFolderChildren ¶
func (j *JournalImpl) GetPastFolderChildren(folder *WeblensFileImpl, time time.Time) ( []*WeblensFileImpl, error, )
func (*JournalImpl) IgnoreLocal ¶
func (j *JournalImpl) IgnoreLocal() bool
func (*JournalImpl) LogEvent ¶
func (j *JournalImpl) LogEvent(fe *FileEvent)
func (*JournalImpl) NewEvent ¶
func (j *JournalImpl) NewEvent() *FileEvent
func (*JournalImpl) SetFileTree ¶
func (j *JournalImpl) SetFileTree(ft *FileTreeImpl)
func (*JournalImpl) SetIgnoreLocal ¶
func (j *JournalImpl) SetIgnoreLocal(ignore bool)
func (*JournalImpl) UpdateLifetime ¶
func (j *JournalImpl) UpdateLifetime(lifetime *Lifetime) error
func (*JournalImpl) WatchFolder ¶
func (j *JournalImpl) WatchFolder(f *WeblensFileImpl) error
type Lifetime ¶
type Lifetime struct { Id FileId `bson:"_id" json:"id"` ContentId string `bson:"contentId,omitempty" json:"contentId,omitempty"` ServerId string `bson:"serverId" json:"serverId"` Actions []*FileAction `bson:"actions" json:"actions"` IsDir bool `bson:"isDir" json:"isDir"` // contains filtered or unexported fields }
func NewLifetime ¶
func NewLifetime(createAction *FileAction) (*Lifetime, error)
func (*Lifetime) Add ¶
func (l *Lifetime) Add(action *FileAction)
func (*Lifetime) GetActions ¶
func (l *Lifetime) GetActions() []*FileAction
func (*Lifetime) GetContentId ¶
func (*Lifetime) GetLatestAction ¶
func (l *Lifetime) GetLatestAction() *FileAction
func (*Lifetime) GetLatestMove ¶
func (l *Lifetime) GetLatestMove() *FileAction
GetLatestMove returns the most recent move or create action in the lifetime. Ideally, this will show the current path of the file
func (*Lifetime) GetLatestPath ¶
func (l *Lifetime) GetLatestPath() WeblensFilepath
func (*Lifetime) GetLatestSize ¶
func (*Lifetime) HasEvent ¶
func (l *Lifetime) HasEvent(eventId FileEventId) bool
func (*Lifetime) IsLive ¶
IsLive returns a boolean representing if this Lifetime shows a file currently on the real filesystem, and has not been deleted.
func (*Lifetime) SetContentId ¶
type MoveInfo ¶
type MoveInfo struct { From *WeblensFileImpl To *WeblensFileImpl }
type WeblensFile ¶
type WeblensFileImpl ¶
type WeblensFileImpl struct {
// contains filtered or unexported fields
}
func NewWeblensFile ¶
func NewWeblensFile(id FileId, filename string, parent *WeblensFileImpl, isDir bool) *WeblensFileImpl
func (*WeblensFileImpl) AbsPath ¶
func (f *WeblensFileImpl) AbsPath() string
AbsPath returns string of the absolute path to file
func (*WeblensFileImpl) AddChild ¶
func (f *WeblensFileImpl) AddChild(child *WeblensFileImpl) error
func (*WeblensFileImpl) Append ¶
func (f *WeblensFileImpl) Append(data []byte) error
func (*WeblensFileImpl) BubbleMap ¶
func (f *WeblensFileImpl) BubbleMap(fn func(*WeblensFileImpl) error) error
BubbleMap Performs fn on f and all parents of f, ignoring the mediaService root or other static directories.
Files are acted on in the order of their index number below, starting with the caller, children are never accessed
f3 <- Parent of f2 | f2 <- Parent of f1 | f1 <- Root caller
func (*WeblensFileImpl) Close ¶
func (f *WeblensFileImpl) Close() error
func (*WeblensFileImpl) CreateSelf ¶
func (f *WeblensFileImpl) CreateSelf() error
func (*WeblensFileImpl) Exists ¶
func (f *WeblensFileImpl) Exists() bool
Exists check if the file exists on the real filesystem below
func (*WeblensFileImpl) Filename ¶
func (f *WeblensFileImpl) Filename() string
Filename returns the filename of the file
func (*WeblensFileImpl) Freeze ¶
func (f *WeblensFileImpl) Freeze() *WeblensFileImpl
Freeze returns a "deep-enough" copy of the file descriptor. All only-locally-relevant fields are copied, however references, except for locks, are the same as the original version
func (*WeblensFileImpl) GetChild ¶
func (f *WeblensFileImpl) GetChild(childName string) (*WeblensFileImpl, error)
func (*WeblensFileImpl) GetChildren ¶
func (f *WeblensFileImpl) GetChildren() []*WeblensFileImpl
func (*WeblensFileImpl) GetContentId ¶
func (f *WeblensFileImpl) GetContentId() string
func (*WeblensFileImpl) GetParent ¶
func (f *WeblensFileImpl) GetParent() *WeblensFileImpl
func (*WeblensFileImpl) GetParentId ¶
func (f *WeblensFileImpl) GetParentId() FileId
func (*WeblensFileImpl) GetPastId ¶
func (f *WeblensFileImpl) GetPastId() FileId
func (*WeblensFileImpl) GetPortablePath ¶
func (f *WeblensFileImpl) GetPortablePath() WeblensFilepath
func (*WeblensFileImpl) ID ¶
func (f *WeblensFileImpl) ID() FileId
ID returns the unique identifier the file, and will compute it on the fly if it is not already initialized in the struct.
This function will intentionally panic if trying to get the ID of a nil file.
func (*WeblensFileImpl) IsDir ¶
func (f *WeblensFileImpl) IsDir() bool
func (*WeblensFileImpl) IsParentOf ¶
func (f *WeblensFileImpl) IsParentOf(child *WeblensFileImpl) bool
func (*WeblensFileImpl) IsReadOnly ¶
func (f *WeblensFileImpl) IsReadOnly() bool
func (*WeblensFileImpl) LeafMap ¶
func (f *WeblensFileImpl) LeafMap(fn func(*WeblensFileImpl) error) error
LeafMap recursively perform fn on leaves, first, and work back up the tree. This takes an inverted "Depth first" approach. Note this behaves very differently than RecursiveMap. See below.
Files are acted on in the order of their index number here, starting with the leftmost leaf
fx.LeafMap(fn) | f5 / \ f3 f4 / \ f1 f2
func (*WeblensFileImpl) LoadStat ¶
func (f *WeblensFileImpl) LoadStat() (newSize int64, err error)
LoadStat will recompute the size and modify date of the file using os.Stat. If the size of the file changes, LoadStat will return the newSize. If the size does not change, LoadStat will return -1 for the newSize. To get the current size of the file, use Size() instead.
func (*WeblensFileImpl) MarshalJSON ¶
func (f *WeblensFileImpl) MarshalJSON() ([]byte, error)
func (*WeblensFileImpl) ModTime ¶
func (f *WeblensFileImpl) ModTime() (t time.Time)
func (*WeblensFileImpl) Mode ¶
func (f *WeblensFileImpl) Mode() os.FileMode
func (*WeblensFileImpl) Name ¶
func (f *WeblensFileImpl) Name() string
func (*WeblensFileImpl) ReadAll ¶
func (f *WeblensFileImpl) ReadAll() ([]byte, error)
func (*WeblensFileImpl) Readdir ¶
func (f *WeblensFileImpl) Readdir(count int) ([]fs.FileInfo, error)
func (*WeblensFileImpl) RecursiveMap ¶
func (f *WeblensFileImpl) RecursiveMap(fn func(*WeblensFileImpl) error) error
RecursiveMap applies function fn to every file recursively
func (*WeblensFileImpl) ReplaceRoot ¶
func (f *WeblensFileImpl) ReplaceRoot(newRoot string)
func (*WeblensFileImpl) Seek ¶
func (f *WeblensFileImpl) Seek(offset int64, whence int) (int64, error)
func (*WeblensFileImpl) SetContentId ¶
func (f *WeblensFileImpl) SetContentId(newContentId string)
func (*WeblensFileImpl) SetMemOnly ¶
func (f *WeblensFileImpl) SetMemOnly(memOnly bool)
func (*WeblensFileImpl) SetSize ¶
func (f *WeblensFileImpl) SetSize(newSize int64)
func (*WeblensFileImpl) SetWatching ¶
func (f *WeblensFileImpl) SetWatching() error
func (*WeblensFileImpl) Size ¶
func (f *WeblensFileImpl) Size() int64
func (*WeblensFileImpl) Sys ¶
func (f *WeblensFileImpl) Sys() any
func (*WeblensFileImpl) UnmarshalJSON ¶
func (f *WeblensFileImpl) UnmarshalJSON(bs []byte) error
func (*WeblensFileImpl) WithLock ¶
func (f *WeblensFileImpl) WithLock(fn func() error) error
WithLock is a quick way to ensure locks on files are lifted if the function using the file is to panic.
type WeblensFilepath ¶
type WeblensFilepath struct {
// contains filtered or unexported fields
}
func NewFilePath ¶
func NewFilePath(root, rootAlias, absolutePath string) WeblensFilepath
func ParsePortable ¶
func ParsePortable(portablePath string) WeblensFilepath
func (WeblensFilepath) Child ¶
func (wf WeblensFilepath) Child(childName string, childIsDir bool) WeblensFilepath
func (WeblensFilepath) Dir ¶
func (wf WeblensFilepath) Dir() WeblensFilepath
func (WeblensFilepath) Filename ¶
func (wf WeblensFilepath) Filename() string
func (WeblensFilepath) IsDir ¶
func (wf WeblensFilepath) IsDir() bool
func (WeblensFilepath) OverwriteRoot ¶
func (wf WeblensFilepath) OverwriteRoot(newRoot string) WeblensFilepath
func (WeblensFilepath) RelativePath ¶
func (wf WeblensFilepath) RelativePath() string
func (WeblensFilepath) RootName ¶
func (wf WeblensFilepath) RootName() string
func (WeblensFilepath) String ¶
func (wf WeblensFilepath) String() string
func (WeblensFilepath) ToPortable ¶
func (wf WeblensFilepath) ToPortable() string