scans

package
v0.0.0-...-df5614f Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ScanProgress

type ScanProgress struct {
	// contains filtered or unexported fields
}

ScanProgress is a type that's used for tracking current running scans, listen to their progress events and invoke cancellations or "done" signals. This allows throttling or cancelling previous scans instead of having many scans running at once for the same files.

The correct usage would be to create a NewScanProgress and call "go Listen()" to listen for cancel/done signals in the background. ScanProgress operations should be done in locked sections.

func NewScanProgress

func NewScanProgress() *ScanProgress

func (*ScanProgress) CancelScan

func (rs *ScanProgress) CancelScan()

func (*ScanProgress) GetCancelChannel

func (rs *ScanProgress) GetCancelChannel() <-chan bool

func (*ScanProgress) GetDoneChannel

func (rs *ScanProgress) GetDoneChannel() <-chan bool

func (*ScanProgress) IsDone

func (rs *ScanProgress) IsDone() bool

IsDone is true if the scan finished whether by cancellation or by a SetDone call

func (*ScanProgress) Listen

func (rs *ScanProgress) Listen(cancel context.CancelFunc, scanNumber int)

Listen waits for cancel or done signals until one of them is received. If the cancel signal is received, the cancel function will be called. Listen stops after the first signal is processed.

func (*ScanProgress) SetDone

func (rs *ScanProgress) SetDone()

SetDone will mark the ScanProgress as done and send a message to the "done" channel. It is safe to call SetDone repeatedly, or after CancelScan was called, so it's ok to defer a function that calls SetDone in a locked section.

Jump to

Keyboard shortcuts

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