model

package
v0.0.0-...-15ef477 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2019 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Drop

type Drop interface {
	// Workers is invoked by a user, so that he knows which workers he can interact with.
	Workers() ([]Worker, error)
	// PutWorker is invoked by a worker to register himself at the drop.
	PutWorker(*Worker) error

	// WorkerRequests is invoked by a worker to retrieve the list of all open requests he shall process.
	WorkerRequests(WorkerId) ([]WorkerRequest, error)
	// PutWorkerRequest is invoked by a user to transfer a request to a worker.
	PutWorkerRequest(WorkerId, *WorkerRequest) error

	// WorkerResponse is invoked by a user to receive the worker's response on a request, and to know that the request
	// has been processed successfully.
	WorkerResponse(WorkerId, WorkerRequestId) (WorkerResponse, error)
	// PutWorkerResponse is invoked by a worker to transfer a response to a successfully processed request.
	PutWorkerResponse(WorkerId, WorkerRequestId, *WorkerResponse) error
}

Drop defines the interface for a drop, able to manage workers and store their requests and responses.

type Worker

type Worker struct {
	Id      WorkerId
	Name    string
	Timeout time.Time

	// PublicKey contains the public RSA key of the worker, marshalled in ASN1 format.
	PublicKey []byte
}

type WorkerId

type WorkerId string

type WorkerRequest

type WorkerRequest struct {
	Id      WorkerRequestId
	Timeout time.Time
	Content []byte

	// ContentType describes the kind of data contained in Content.
	ContentType string

	// EncryptionType describes the kind of encryption applied to Content.
	EncryptionType string
}

type WorkerRequestId

type WorkerRequestId string

type WorkerResponse

type WorkerResponse struct {
	Timeout     time.Time
	Content     []byte
	ContentType string
}

Jump to

Keyboard shortcuts

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