junction

package
v0.0.0-...-9c214a8 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2015 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrAuthenticationError is returned if the given authentication details for
	// an operation were incorrect. This could mean the token itself isn't valid,
	// or that the token was not authorized for that operation.
	ErrAuthenticationError = errors.New("could not authenticate")
)

Functions

This section is empty.

Types

type AdminHandler

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

An AdminHandler handles requests from administrators. This mostly contains diagnostic and informational commands.

func (*AdminHandler) ListWorkers

func (h *AdminHandler) ListWorkers(token string) ([]database.Worker, error)

type AuthService

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

func (*AuthService) AuthenticateAdmin

func (as *AuthService) AuthenticateAdmin(token string) bool

AuthenticateAdmin returns true if the given token is a valid token for an administrator.

func (*AuthService) AuthenticateWorker

func (as *AuthService) AuthenticateWorker(token string) bool

AuthenticateWorker returns true if the given token is a valid token for a worker.

type Core

type Core struct {
	AdminHandler  *AdminHandler
	WorkerHandler *WorkerHandler
	// contains filtered or unexported fields
}

Core is used as a central manager for Junction activity. It is the primary point of interface for API handlers.

func NewCore

func NewCore(conf *CoreConfig) (*Core, error)

func TestCore

func TestCore(t *testing.T) *Core

TestCore returns a pure in-memory core for testing.

type CoreConfig

type CoreConfig struct {
	Database     database.Database
	AdminTokens  []string
	WorkerTokens []string
}

type WorkerHandler

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

A WorkerHandler handles requests from workers.

func (*WorkerHandler) Create

func (h *WorkerHandler) Create(token string, queue string, maxJobCount int, attributes map[string]string) (string, error)

Create creates an internal record of a worker with the given attributes, and returns the workers UUID or an error.

Jump to

Keyboard shortcuts

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