Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrCannotImport is returned whenever we are told to reload but cannot due to missing import_directory ErrCannotImport = errors.New("filemanager: cannot import because import_directory is not set in the config") // SystemUserUUID is the UUID of files uploaded by the GoCrack system SystemUserUUID = "b2c9e661-74e5-4ba3-b1ce-624894e85622" )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { TaskUploadPath string `yaml:"task_file_path"` EngineFilePath string `yaml:"engine_file_path"` TempPath string `yaml:"temp_path"` TaskMaxSize *int `yaml:"task_max_upload_size,omitempty"` ImportPath *string `yaml:"import_path,omitempty"` }
Config describes the settings available to GoCrack's filemanager
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context contains the state of the filemanager and provides public methods to interact with all filesystem actions within gocrack
func New ¶
func New(stor FileManagerStor, cfg Config) *Context
New creates a new FileManager for GoCrack
func (*Context) DeleteFile ¶
DeleteFile removes the file from the system
func (*Context) Refresh ¶
Refresh checks the import directory for new files and saves them into the database
func (*Context) SaveFile ¶
func (s *Context) SaveFile(src io.ReadCloser, filename string, fileUUID string, filetype interface{}) (*FileSaveResponse, error)
SaveFile returns metadata about the file and saves the file to disk
type FileManagerStor ¶
type FileSaveResponse ¶
type WriteSizeLineRecorder ¶
type WriteSizeLineRecorder struct {
// contains filtered or unexported fields
}
WriteSizeLineRecorder records the total size of a write and includes the # of lines
func (WriteSizeLineRecorder) Lines ¶
func (w WriteSizeLineRecorder) Lines() int64
Lines returns the total number of new lines detected
func (WriteSizeLineRecorder) Size ¶
func (w WriteSizeLineRecorder) Size() int64
Size indicates the total size written to this recorder
type WriteSizeRecorder ¶
type WriteSizeRecorder struct {
// contains filtered or unexported fields
}
WriteSizeRecorder records the total size of a write (helpful in a multiwriter)
func (WriteSizeRecorder) Size ¶
func (w WriteSizeRecorder) Size() int64
Size indicates the total size written to this recorder