watcher

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checker

type Checker interface {
	Check(userId string, request model.HttpRequest, hashType string, lastHash string) (changed bool, newHash string, err error)
}

type CleanupChecker

type CleanupChecker interface {
	Check(model.WatchedEntity) (remove bool, err error)
}

type Trigger

type Trigger interface {
	Run(userId string, trigger model.HttpRequest) error
}

type Watcher

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

func New

func New(config configuration.Config, db db.Database, check Checker, trigger Trigger, cleanupChecker CleanupChecker) *Watcher

func (*Watcher) DeleteWatcher

func (this *Watcher) DeleteWatcher(userId string, watcherId string) (err error)

func (*Watcher) Run

func (this *Watcher) Run(batchSize int64) (count int, err error)

func (*Watcher) RunLoop

func (this *Watcher) RunLoop(ctx context.Context, batchSize int64) error

RunLoop calls Run until count is 0, an error is returned ore ctx is done

func (*Watcher) Set

func (this *Watcher) Set(entity model.WatchedEntityInit) error

func (*Watcher) Start

func (this *Watcher) Start(ctx context.Context, wg *sync.WaitGroup) error

Start watching cycle with configured WatchInterval wg may be nil

func (*Watcher) StartWithInterval

func (this *Watcher) StartWithInterval(ctx context.Context, wg *sync.WaitGroup, interval time.Duration)

StartWithInterval starts watching cycle with given interval wg may be nil

Directories

Path Synopsis
api
db

Jump to

Keyboard shortcuts

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