jobs

package
v0.0.0-...-3bbf888 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2019 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyCrawlBucket = "crawl_bucket"
)
View Source
const (
	KeyParseS3Log = "parse_s3_log"
)

Variables

View Source
var (
	ErrImmediateReschedule = errors.New("reschedule ASAP")
	ErrDidNotReschedule    = errors.New("no need to reschedule, we are done")
)

Functions

func CrawlBucket

func CrawlBucket(logger *log.Logger, qc *cque.Client, j *cque.Job, appconfig map[string]interface{}) error

Example - we can wrap the other function

func Getlogsfroms3

func Getlogsfroms3(bucket, key string, appconfig map[string]interface{}) ([]byte, error)

Getlogsfroms3 - Download flowlog from s3, decompress using gzip

func Getsubfolder

func Getsubfolder(bucket, path string) ([]string, error)

func Isinternal

func Isinternal(ip string) bool

Check If ip is not between internal ranges

	10.0.0.0 – 10.255.255.255
 172.16.0.0 – 172.31.255.255
 192.168.0.0 – 192.168.255.255

func Listfileinfolder

func Listfileinfolder(bucket, path string, depth int) ([]string, error)

func ParseS3Log

func ParseS3Log(logger *log.Logger, qc *cque.Client, j *cque.Job, appconfig map[string]interface{}) error

Types

type Connection

type Connection struct {
	From string
	To   string
	Port int64
}

func (Connection) String

func (c Connection) String() string

type CrawlBucketJob

type CrawlBucketJob struct {
	Bucketname string
	Bucketpath string
	Depth      int
}

type JobFunc

type JobFunc func(logger *log.Logger, qc *que.Client, job *que.Job, appconfig map[string]interface{}) error

JobFunc should do a thing. Return either: nil => No error, move onto next job ErrImmediateReschedule => wrapper try it again immediately. ErrDidNotReschedule => wrapper will rely on queue lib to reschedule or retry. any other error => wrapper will rely on que to reschedule

type JobFuncWrapper

type JobFuncWrapper struct {
	QC        *que.Client
	Logger    *log.Logger
	F         JobFunc
	AppConfig map[string]interface{}
}

func (*JobFuncWrapper) Run

func (scw *JobFuncWrapper) Run(job *que.Job) error

type ParseS3LogJob

type ParseS3LogJob struct {
	Bucketname string
	Objectpath string
}

Jump to

Keyboard shortcuts

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