backend

package
v0.0.17 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ScanSubject        = "scanner.queue.scan"
	ReportSubject      = "scanner.report"
	TrivyRefreshPeriod = time.Hour * 6
)
View Source
const (
	Dev deploymentMode = iota
	Production
)

Variables

View Source
var DeploymentMode = Dev

Functions

func ErrorToAPIStatus

func ErrorToAPIStatus(err error) *metav1.Status

ErrorToAPIStatus converts an error to an metav1.Status object.

func ExistsReport

func ExistsReport(fs blobfs.Interface, img string) (bool, error)

func GRPCCode

func GRPCCode(err error) gcerrors.ErrorCode

GRPCCode extracts the gRPC status code and converts it into an ErrorCode. It returns Unknown if the error isn't from gRPC.

func GetResponseFromBackend added in v0.0.7

func GetResponseFromBackend(nc *nats.Conn, img string) (trivy.BackendResponse, error)

func HTTPStatusFromCode

func HTTPStatusFromCode(code gcerrors.ErrorCode) int32

HTTPStatusFromCode converts a gRPC error code into the corresponding HTTP response status. See: https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto See: https://github.com/grpc-ecosystem/grpc-gateway/blob/v2.11.3/runtime/errors.go#L34-L77

func NewBlobFS

func NewBlobFS() blobfs.Interface

func NewConnection

func NewConnection(addr, credFile string) (nc *nats.Conn, err error)

NewConnection creates a new NATS connection

func ReadFromBucket added in v0.0.7

func ReadFromBucket(fs blobfs.Interface, img string) ([]byte, error)

func UploadReport

func UploadReport(fs blobfs.Interface, img string) error

Types

type Manager

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

func New

func New(nc *nats.Conn, opts Options) *Manager

func (*Manager) Start

func (mgr *Manager) Start(ctx context.Context, jsmOpts ...nats.JSOpt) error

type Options

type Options struct {
	AckWait time.Duration

	// same as stream
	Stream string

	// manager id, < 0 means auto detect
	Id int
	// hostname
	Name string

	NumReplicas int
	NumWorkers  int

	FS blobfs.Interface
}

func DefaultOptions

func DefaultOptions() Options

Jump to

Keyboard shortcuts

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