scheduler

package
v1.16.9 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Overview

Copyright 2021 Yahoo.

Licensed 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.

Copyright 2021 Yahoo.

Licensed 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.

Copyright 2021 Yahoo.

Licensed 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.

Copyright 2021 Yahoo.

Licensed 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 CollectRequest

func CollectRequest(ctx context.Context, requestChan <-chan Request, p *Pool)

CollectRequest is responsible for receiving work requests from the client & enqueues the request to the requestQueue as part of a go routine

Types

type Counter

type Counter uint32

func (*Counter) Get

func (c *Counter) Get() uint32

func (*Counter) Inc

func (c *Counter) Inc() uint32

func (*Counter) Reset

func (c *Counter) Reset() uint32

type DoWorker

type DoWorker interface {
	DoWork(ctx context.Context, worker *Worker)
}

DoWorker is an interface for doing actual work

type Pool

type Pool struct {
	Name           string
	PoolSize       int
	FeatureEnabled bool
	PKCS11Timeout  time.Duration
	// contains filtered or unexported fields
}

Pool is a struct which holds information about the workers & queue for the job.

type Request

type Request struct {
	Priority proto.Priority
	DoWorker
}

Request is a struct which has priority & a DoWorker interface.

type Worker

type Worker struct {
	ID             int            // ID is a unique id for the worker
	Priority       proto.Priority // Priority indicates the priority of the request the worker is handling.
	PKCS11Timeout  time.Duration  // PKCS11Timeout is the max time a worker can wait to get signer from pool.
	TotalProcessed Counter        // TotalProcessed indicates the total requests processed per priority by this worker.
	TotalTimeout   Counter        // TotalTimeout indicates the total requests that timed out before worker could process it.
	Quit           chan struct{}  // Quit is a channel to cancel the worker
}

Worker struct stores worker information including worker id, priority & workerQ for indicating if the worker is idle or not.

func (*Worker) String

func (w *Worker) String() string

Jump to

Keyboard shortcuts

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