stage

package
v1.18.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadCompanions

func ReadCompanions(r io.Reader) (cmps []*sts.Partial, err error)

ReadCompanions implements sts.DecodePartials

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) CleanNow

func (s *Stage) CleanNow()

func (*Stage) GetFileStatus

func (s *Stage) GetFileStatus(relPath string, sent time.Time) int

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

func (s *Stage) Prepare(parts []sts.Binned)

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) Prune

func (s *Stage) Prune(minAge time.Duration)

func (*Stage) Ready

func (s *Stage) Ready() bool

Ready returns whether or not this gate keeper is ready to receive data

func (*Stage) Receive

func (s *Stage) Receive(file *sts.Partial, reader io.Reader) (err error)

Receive reads a single file part with file metadata and reader

func (*Stage) Received

func (s *Stage) Received(parts []sts.Binned) (n int)

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

func (*Stage) Scan

func (s *Stage) Scan(version string) (jsonBytes []byte, err error)

Scan walks the stage area tree looking for companion files and returns any found in the form of a JSON-encoded byte array

func (*Stage) Stop

func (s *Stage) Stop(force bool)

Stop waits for the number of files in the pipe to be zero and then signals

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL