Documentation ¶
Index ¶
- func ReadCompanions(r io.Reader) (cmps []*sts.Partial, err error)
- type Stage
- func (s *Stage) CleanNow()
- func (s *Stage) GetFileStatus(relPath string, sent time.Time) int
- func (s *Stage) Prepare(parts []sts.Binned)
- func (s *Stage) Prune(minAge time.Duration)
- func (s *Stage) Ready() bool
- func (s *Stage) Receive(file *sts.Partial, reader io.Reader) (err error)
- func (s *Stage) Received(parts []sts.Binned) (n int)
- func (s *Stage) Recover()
- func (s *Stage) Scan(version string) (jsonBytes []byte, err error)
- func (s *Stage) Stop(force bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Stage ¶
type Stage struct {
// contains filtered or unexported fields
}
Stage is the manager for all things file reception
func New ¶
func New(name, rootDir, targetDir string, logger sts.ReceiveLogger, dispatcher sts.Dispatcher) *Stage
New creates a new instance of Stage where the rootDir is the directory for the stage area (will append {source}/), targetDir is where files should be moved once validated, and logger instance for logging files received
func (*Stage) GetFileStatus ¶
GetFileStatus returns the status of a file based on its source, name, and time sent
It returns one of these constants: -> sts.ConfirmPassed: MD5 validation was successful and file put away -> sts.ConfirmFailed: MD5 validation was unsuccessful and file should be resent -> sts.ConfirmWaiting: MD5 validation was successful but waiting on predecessor -> sts.ConfirmNone: No knowledge of file
func (*Stage) Prepare ¶
Prepare is called with all binned parts of a request before each one is "Receive"d (below). We want to initialize the files in the stage area.
func (*Stage) Received ¶
Received returns how many (starting at index 0) of the input file parts have been successfully received
func (*Stage) Recover ¶
func (s *Stage) Recover()
Recover is meant to be run while the server is not so it can cleanly address files in the stage area that should be completed from the previous server run