packet

package
v2.0.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2015 License: Apache-2.0 Imports: 5 Imported by: 0

README

packet

-- import "gopkg.in/Clever/gearman.v2/packet"

Package packet provides structures to marshal binary data to and from binary data. The specification is located at http://gearman.org/protocol/.

Usage

var (
	// Req is the code for a Request packet
	Req = packetCode([]byte{0, byte('R'), byte('E'), byte('Q')})
	// Res is the code for a Response packet
	Res = packetCode([]byte{0, byte('R'), byte('E'), byte('S')})
)
type Packet
type Packet struct {
	// The Code for the packet: either \0REQ or \0RES
	Code packetCode
	// The Type of the packet, e.g. WorkStatus
	Type Type
	// The Arguments of the packet
	Arguments [][]byte
}

Packet contains a Gearman packet. See http://gearman.org/protocol/

func (*Packet) MarshalBinary
func (packet *Packet) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface

func (*Packet) UnmarshalBinary
func (packet *Packet) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface

type Type
type Type int

Type represents the type of the Gearman packet

const (
	// PreSleep = PRE_SLEEP
	PreSleep = 4
	// SubmitJob = SUBMIT_JOB
	SubmitJob Type = 7
	// JobCreated = JOB_CREATED
	JobCreated = 8
	// JobAssign = JOB_ASSIGN
	JobAssign = 11
	// WorkStatus = WORK_STATUS
	WorkStatus = 12
	// WorkComplete = WORK_COMPLETE
	WorkComplete = 13
	// WorkFail = WORK_FAIL
	WorkFail = 14
	// SubmitJobBg = SUBMIT_JOB_BG
	SubmitJobBg = 18
	// WorkData = WORK_DATA
	WorkData = 28
	// WorkWarning = WORK_WARNING
	WorkWarning = 29
)

Documentation

Overview

Package packet provides structures to marshal binary data to and from binary data. The specification is located at http://gearman.org/protocol/.

Index

Constants

View Source
const (
	// PreSleep = PRE_SLEEP
	PreSleep = 4
	// SubmitJob = SUBMIT_JOB
	SubmitJob Type = 7
	// JobCreated = JOB_CREATED
	JobCreated = 8
	// JobAssign = JOB_ASSIGN
	JobAssign = 11
	// WorkStatus = WORK_STATUS
	WorkStatus = 12
	// WorkComplete = WORK_COMPLETE
	WorkComplete = 13
	// WorkFail = WORK_FAIL
	WorkFail = 14
	// SubmitJobBg = SUBMIT_JOB_BG
	SubmitJobBg = 18
	// WorkData = WORK_DATA
	WorkData = 28
	// WorkWarning = WORK_WARNING
	WorkWarning = 29
)

Variables

View Source
var (
	// Req is the code for a Request packet
	Req = packetCode([]byte{0, byte('R'), byte('E'), byte('Q')})
	// Res is the code for a Response packet
	Res = packetCode([]byte{0, byte('R'), byte('E'), byte('S')})
)

Functions

This section is empty.

Types

type Packet

type Packet struct {
	// The Code for the packet: either \0REQ or \0RES
	Code packetCode
	// The Type of the packet, e.g. WorkStatus
	Type Type
	// The Arguments of the packet
	Arguments [][]byte
}

Packet contains a Gearman packet. See http://gearman.org/protocol/

func (*Packet) MarshalBinary

func (packet *Packet) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface

func (*Packet) UnmarshalBinary

func (packet *Packet) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface

type Type

type Type int

Type represents the type of the Gearman packet

Jump to

Keyboard shortcuts

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