Documentation ¶
Index ¶
- Constants
- Variables
- type Directory
- func (d *Directory) AddEntryToDir(parentDir, podPassword, itemToAdd string, isFile bool) error
- func (d *Directory) AddRootDir(podName, podPassword string, podAddress utils.Address, fd *feed.API) error
- func (d *Directory) AddToDirectoryMap(path string, dirInode *Inode)
- func (d *Directory) Chmod(dirNameWithPath, podPassword string, mode uint32) error
- func (d *Directory) DirStat(podName, podPassword, dirNameWithPath string) (*Stats, error)
- func (d *Directory) GetDirFromDirectoryMap(path string) *Inode
- func (d *Directory) GetInode(podPassword, dirNameWithPath string) (*Inode, error)
- func (d *Directory) IsDirectoryPresent(directoryNameWithPath, podPassword string) bool
- func (d *Directory) ListDir(dirNameWithPath, podPassword string) ([]Entry, []string, error)
- func (d *Directory) MkDir(dirToCreateWithPath, podPassword string, mode uint32) error
- func (d *Directory) MkRootDir(podName, podPassword string, podAddress utils.Address, fd *feed.API) error
- func (d *Directory) RemoveAllFromDirectoryMap()
- func (d *Directory) RemoveEntryFromDir(parentDir, podPassword, itemToDelete string, isFile bool) error
- func (d *Directory) RemoveFromDirectoryMap(path string)
- func (d *Directory) RemoveInode(podPassword, dirNameWithPath string) error
- func (d *Directory) RenameDir(dirNameWithPath, newDirNameWithPath, podPassword string) error
- func (d *Directory) RmDir(directoryNameWithPath, podPassword string) error
- func (d *Directory) RmRootDir(podPassword string) error
- func (d *Directory) SetInode(podPassword string, iNode *Inode) error
- func (d *Directory) SyncDirectory(dirNameWithPath, podPassword string) error
- func (d *Directory) SyncDirectoryAsync(ctx context.Context, dirNameWithPath, podPassword string, wg *sync.WaitGroup) error
- type Entry
- type Inode
- func (in *Inode) GetDirInodePathAndName() string
- func (in *Inode) GetDirInodePathAndNameForRoot() string
- func (in *Inode) GetDirInodePathOnly() string
- func (in *Inode) GetFileOrDirNames() []string
- func (in *Inode) GetMeta() *MetaData
- func (in *Inode) IsDirInodeRoot() bool
- func (in *Inode) SetFileOrDirNames(fileOrDirNames []string)
- func (in *Inode) Unmarshal(data []byte) error
- type MetaData
- type Stats
Constants ¶
const (
// MimeTypeDirectory is the mime type for directory
MimeTypeDirectory = "inode/directory"
)
const (
// S_IFDIR is the mode for directory
S_IFDIR = 0040000
)
Variables ¶
var ( // ErrInvalidDirectoryName is returned when the directory name is invalid ErrInvalidDirectoryName = errors.New("invalid directory name") // ErrTooLongDirectoryName is returned when the directory name is too long ErrTooLongDirectoryName = errors.New("too long directory name") // ErrDirectoryAlreadyPresent is returned when the directory is already present ErrDirectoryAlreadyPresent = errors.New("directory name already present") // ErrDirectoryNotPresent is returned when the directory is not present ErrDirectoryNotPresent = errors.New("directory not present") // ErrInvalidFileOrDirectoryName is returned when the file or directory name is invalid ErrInvalidFileOrDirectoryName = errors.New("invalid file or directory name") )
var ( // ErrResourceDeleted is returned when the resource is deleted ErrResourceDeleted = errors.New("resource was deleted") )
var ( // MetaVersion is the version of the metadata for directories MetaVersion uint8 = 2 )
Functions ¶
This section is empty.
Types ¶
type Directory ¶
type Directory struct {
// contains filtered or unexported fields
}
Directory is the type used to define a directory in a pod
func NewDirectory ¶
func NewDirectory(podName string, client blockstore.Client, fd *feed.API, user utils.Address, file f.IFile, m taskmanager.TaskManagerGO, logger logging.Logger) *Directory
NewDirectory the main directory object that handles all the directory related functions.
func (*Directory) AddEntryToDir ¶ added in v0.5.3
AddEntryToDir adds a new entry (directory/file) to a given directory. This is typically called when a new directory is created under the given directory or a new file is uploaded under the given directory.
func (*Directory) AddRootDir ¶ added in v0.6.2
func (d *Directory) AddRootDir(podName, podPassword string, podAddress utils.Address, fd *feed.API) error
AddRootDir adds the root directory to the directory map
func (*Directory) AddToDirectoryMap ¶
AddToDirectoryMap adds a directory in the path
func (*Directory) Chmod ¶ added in v0.9.2
Chmod does all the validation for the existence of the file and changes file mode
func (*Directory) GetDirFromDirectoryMap ¶
GetDirFromDirectoryMap returns the directory Inode of the given path
func (*Directory) IsDirectoryPresent ¶ added in v0.5.3
IsDirectoryPresent this function check if a given directory is present inside the pod.
func (*Directory) ListDir ¶
ListDir given a directory, this function lists all the children (directory) inside the given directory. it also creates a list of files inside the directory and gives it back, so that the file listing function can give information about those files.
func (*Directory) MkRootDir ¶ added in v0.5.3
func (d *Directory) MkRootDir(podName, podPassword string, podAddress utils.Address, fd *feed.API) error
MkRootDir creates the root directory for the pod
func (*Directory) RemoveAllFromDirectoryMap ¶ added in v0.5.3
func (d *Directory) RemoveAllFromDirectoryMap()
RemoveAllFromDirectoryMap resets user dirMap
func (*Directory) RemoveEntryFromDir ¶ added in v0.5.3
func (d *Directory) RemoveEntryFromDir(parentDir, podPassword, itemToDelete string, isFile bool) error
RemoveEntryFromDir removes an entry (directory/file) under the given directory. This is typically called when a directory is deleted under the given directory or a file is removed under the given directory.
func (*Directory) RemoveFromDirectoryMap ¶
RemoveFromDirectoryMap removes a directory from the path
func (*Directory) RemoveInode ¶ added in v0.10.0
RemoveInode removes the inode of the given directory
func (*Directory) RmDir ¶ added in v0.5.3
RmDir removes a given directory and all the entries (file/directory) under that.
func (*Directory) RmRootDir ¶ added in v0.7.0
RmRootDir removes root directory and all the entries (file/directory) under that.
func (*Directory) SyncDirectory ¶ added in v0.5.3
SyncDirectory syncs all the latest entries under a given directory.
type Entry ¶ added in v0.5.3
type Entry struct { Name string `json:"name"` ContentType string `json:"contentType"` Size string `json:"size,omitempty"` Mode uint32 `json:"mode"` BlockSize string `json:"blockSize,omitempty"` CreationTime string `json:"creationTime"` ModificationTime string `json:"modificationTime"` AccessTime string `json:"accessTime"` }
Entry is the structure of the directory entry
type Inode ¶ added in v0.5.3
Inode is the structure of the inode
func (*Inode) GetDirInodePathAndName ¶ added in v0.5.3
GetDirInodePathAndName returns full path of the node from root
func (*Inode) GetDirInodePathAndNameForRoot ¶ added in v0.5.3
GetDirInodePathAndNameForRoot returns full path of the root node
func (*Inode) GetDirInodePathOnly ¶ added in v0.5.3
GetDirInodePathOnly returns path of the node
func (*Inode) GetFileOrDirNames ¶ added in v0.5.3
GetFileOrDirNames returns file and folder names in iNode skipcq: TCV-001
func (*Inode) IsDirInodeRoot ¶ added in v0.5.3
IsDirInodeRoot check if the node is root dir
func (*Inode) SetFileOrDirNames ¶ added in v0.5.3
SetFileOrDirNames sets file and folder names in iNode skipcq: TCV-001
type MetaData ¶ added in v0.5.3
type MetaData struct { Version uint8 `json:"version"` Path string `json:"path"` Name string `json:"name"` CreationTime int64 `json:"creationTime"` AccessTime int64 `json:"accessTime"` ModificationTime int64 `json:"modificationTime"` Mode uint32 `json:"mode"` }
MetaData is the metadata of a directory
type Stats ¶ added in v0.9.1
type Stats struct { PodName string `json:"podName"` DirPath string `json:"dirPath"` DirName string `json:"dirName"` Mode uint32 `json:"mode"` CreationTime string `json:"creationTime"` ModificationTime string `json:"modificationTime"` AccessTime string `json:"accessTime"` NoOfDirectories string `json:"noOfDirectories"` NoOfFiles string `json:"noOfFiles"` }
Stats represents a given directory