Files
crawlab/core/entity/fs_file_info.go
Marvin Zhang 41e973a4d3 fix: misaligned nodes when running tasks from a schedule through enhancement by adding new route and handler for running schedules
- Introduced a new POST endpoint '/:id/run' in the router to trigger the execution of a schedule.
- Implemented the PostScheduleRun function to handle the execution logic, including validation of input parameters and scheduling tasks.
- Refactored the PostSpiderRun function to streamline the scheduling process by directly calling the admin service.
- Updated the FsFileInfo struct to clarify the children field description.
- Modified the Task model to make NodeIds field optional in JSON serialization.
2024-12-21 15:33:07 +08:00

61 lines
1.5 KiB
Go

package entity
import (
"github.com/crawlab-team/crawlab/core/interfaces"
"os"
"time"
)
type FsFileInfo struct {
Name string `json:"name"` // file name
Path string `json:"path"` // file path
FullPath string `json:"full_path"` // file full path
Extension string `json:"extension"` // file extension
IsDir bool `json:"is_dir"` // whether it is directory
FileSize int64 `json:"file_size"` // file size (bytes)
Children []interfaces.FsFileInfo `json:"children"` // children for subdirectory
ModTime time.Time `json:"mod_time"` // modification time
Mode os.FileMode `json:"mode"` // file mode
Hash string `json:"hash"` // file hash
}
func (f *FsFileInfo) GetName() string {
return f.Name
}
func (f *FsFileInfo) GetPath() string {
return f.Path
}
func (f *FsFileInfo) GetFullPath() string {
return f.FullPath
}
func (f *FsFileInfo) GetExtension() string {
return f.Extension
}
func (f *FsFileInfo) GetIsDir() bool {
return f.IsDir
}
func (f *FsFileInfo) GetFileSize() int64 {
return f.FileSize
}
func (f *FsFileInfo) GetModTime() time.Time {
return f.ModTime
}
func (f *FsFileInfo) GetMode() os.FileMode {
return f.Mode
}
func (f *FsFileInfo) GetHash() string {
return f.Hash
}
func (f *FsFileInfo) GetChildren() []interfaces.FsFileInfo {
return f.Children
}