async

package
v0.0.0-...-7847555 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2018 License: CC0-1.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TaskCodes

func TaskCodes(sc TasksAndMetadataer) []serverutil.TaskCode

TaskCodes returns a slice of all assigned tasks codes. The task codes are sorted in assigned order, from oldest (at index 0) to most recent.

func WriteTaskID

func WriteTaskID(w binaryutil.BasicWriter, id TaskID) error

WriteTaskID write the task ID (4 bytes; uint32) to the writer w.

Types

type TaskID

type TaskID uint32

TaskID is a four-byte value chosen by the client to identity tasks submitted to the server. It should be unique for all currently active tasks submitted by this client.

func ReadTaskID

func ReadTaskID(r binaryutil.BasicReader) (TaskID, error)

ReadTaskID reads the task ID (4 bytes; uint32) from the reader r.

func (TaskID) String

func (id TaskID) String() string

String returns a string description of the task ID.

type TaskMetadata

type TaskMetadata struct {
	ID        TaskID              // The task id
	Code      serverutil.TaskCode // The task code
	Timestamp time.Time           // The timestamp for this task
}

TaskMetadata is the basic metadata associated with a task.

type TasksAndMetadataer

type TasksAndMetadataer interface {
	Tasks() []TaskID                  // Tasks returns a slice of all assigned task ids. The ids are distinct, and sorted in increasing order.
	Metadata(id TaskID) *TaskMetadata // Metadata returns the metadata for the given task id, or nil if no currently assigned task has this id.
}

TasksAndMetadataer is the interface satisfied by an object with both a Tasks and a Metadata method.

Directories

Path Synopsis
Package asyncserver provides the framework for an async server.
Package asyncserver provides the framework for an async server.

Jump to

Keyboard shortcuts

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