scanqueue

package
v0.0.0-...-b9085d8 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Copyright (C) 2020 Synopsys, Inc.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunScanQueue

func RunScanQueue(configPath string, stop <-chan struct{})

RunScanQueue ...

func SetupHTTPServer

func SetupHTTPServer(responder Responder)

SetupHTTPServer .....

Types

type Client

type Client struct {
	Resty *resty.Client
	Host  string
	Port  int
}

Client ...

func NewClient

func NewClient(host string, port int) *Client

NewClient ...

func (*Client) AddJob

func (ac *Client) AddJob(key string, data interface{}) error

AddJob ...

func (*Client) GetModel

func (ac *Client) GetModel() (string, error)

GetModel ...

func (*Client) GetNextJob

func (ac *Client) GetNextJob(res interface{}) error

GetNextJob ...

func (*Client) PostFinishedJob

func (ac *Client) PostFinishedJob(jobResult *JobResult) error

PostFinishedJob ...

type ClientInterface

type ClientInterface interface {
	AddJob(key string, data interface{}) error
	GetNextJob(result interface{}) error
	PostFinishedJob(key string, jobErr error) error
}

ClientInterface ...

type Config

type Config struct {
	Port int

	Jobs map[string]interface{}

	LogLevel string
}

Config ...

func GetConfig

func GetConfig(configPath string) (*Config, error)

GetConfig ...

func (*Config) GetLogLevel

func (config *Config) GetLogLevel() (log.Level, error)

GetLogLevel ...

type Job

type Job struct {
	Key  string
	Data interface{}
}

type JobResult

type JobResult struct {
	Key string
	Err string
}

type Metrics

type Metrics struct {
}

Metrics .....

type Model

type Model struct {
	ScanQueue *util.PriorityQueue
	// contains filtered or unexported fields
}

Model ...

func NewModel

func NewModel() *Model

NewModel .....

func (*Model) AddJob

func (model *Model) AddJob(job Job) error

func (*Model) Error

func (model *Model) Error(w http.ResponseWriter, r *http.Request, err error, statusCode int)

Error .....

func (*Model) GetModel

func (model *Model) GetModel() ([]byte, error)

GetModel ...

func (*Model) GetNextJob

func (model *Model) GetNextJob() (interface{}, error)

GetNextJob returns nil if no job was found

func (*Model) NotFound

func (model *Model) NotFound(w http.ResponseWriter, r *http.Request)

NotFound .....

func (*Model) PostFinishJob

func (model *Model) PostFinishJob(jobResult JobResult) error

PostFinishJob ...

type Responder

type Responder interface {
	GetModel() ([]byte, error)

	AddJob(job Job) error
	GetNextJob() (interface{}, error)
	PostFinishJob(result JobResult) error

	NotFound(w http.ResponseWriter, r *http.Request)
	Error(w http.ResponseWriter, r *http.Request, err error, statusCode int)
}

Responder .....

Jump to

Keyboard shortcuts

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