proc

package
v4.2.1-rc1 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package proc provides actual actions to be performed once the sync has filtered all events

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectedProcessor

type ConnectedProcessor struct {
	Processor

	PatchChan chan merger.Patch
	LocksChan chan model.LockEvent
	Cmd       *model.Command
}

ConnectedProcessor is an extended flavour of Processor that listens to a PatchChan and sends LockEvents and Requeue Scan Events

func NewConnectedProcessor

func NewConnectedProcessor(ctx context.Context, cmd *model.Command) *ConnectedProcessor

NewConnectedProcessor creates a new connected processor

func (*ConnectedProcessor) LockFile

func (pr *ConnectedProcessor) LockFile(operation merger.Operation, path string, operationId string)

LockFile implements Connector func

func (*ConnectedProcessor) ProcessPatches

func (pr *ConnectedProcessor) ProcessPatches()

ProcessPatches listens to PatchChan for processing

func (*ConnectedProcessor) SetLocksChan

func (pr *ConnectedProcessor) SetLocksChan(locks chan model.LockEvent)

SetLocksChan sets the locks event channel

func (*ConnectedProcessor) Start

func (pr *ConnectedProcessor) Start()

Start starts listening for Patch channel

func (*ConnectedProcessor) Stop

func (pr *ConnectedProcessor) Stop()

Stop closes Patch Channel and Interrupt Channel

func (*ConnectedProcessor) UnlockFile

func (pr *ConnectedProcessor) UnlockFile(operation merger.Operation, path string)

UnlockFile implements Connector func

type ProcessFunc

type ProcessFunc func(canceler context.Context, event merger.Operation, operationId string, progress chan int64) error

ProcessFunc is a generic function signature for applying an operation

type Processor

type Processor struct {
	GlobalContext    context.Context
	Locker           ProcessorLocker
	QueueSize        int
	Silent           bool
	SkipTargetChecks bool
	Ignores          []glob.Glob
	PatchListener    merger.PatchListener
}

Processor is a simple processor without external connections

func NewProcessor

func NewProcessor(ctx context.Context) *Processor

NewProcessor creates a new processor

func (*Processor) Logger

func (pr *Processor) Logger() log.ZapLogger

Logger is a shortcut for log.Logger(pr.globalContext) function

func (*Processor) Process

func (pr *Processor) Process(patch merger.Patch, cmd *model.Command)

Process calls all Operations to be performed on a Patch

type ProcessorLocker

type ProcessorLocker interface {
	// LockFile sends LockEvent for Echo Filtering
	LockFile(operation merger.Operation, path string, operationId string)
	// UnlockFile sends UnlockEvent for Echo Filtering
	UnlockFile(operation merger.Operation, path string)
}

ProcessorLocker defines a set of event based functions that can be called during processing

Jump to

Keyboard shortcuts

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