Version: v0.0.0-...-fd4faf2 Latest Latest

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

Go to latest
Published: May 11, 2016 License: BSD-2-Clause, MIT Imports: 6 Imported by: 0



kvmsg class - key-value message class for example applications



This section is empty.


This section is empty.


This section is empty.


type Kvmsg

type Kvmsg struct {
	// contains filtered or unexported fields

Structure of our class

func NewKvmsg

func NewKvmsg(sequence int64) (kvmsg *Kvmsg)

Constructor, takes a sequence number for the new Kvmsg instance.

func RecvKvmsg

func RecvKvmsg(socket *zmq.Socket) (kvmsg *Kvmsg, err error)

The RecvKvmsg function reads a key-value message from socket, and returns a new Kvmsg instance.

func (*Kvmsg) Dump

func (kvmsg *Kvmsg) Dump()

The dump method extends the kvsimple implementation with support for message properties.

func (*Kvmsg) Dup

func (kvmsg *Kvmsg) Dup() (dup *Kvmsg)

The Dup method duplicates a kvmsg instance, returns the new instance.

func (*Kvmsg) GetBody

func (kvmsg *Kvmsg) GetBody() (body string, err error)

func (*Kvmsg) GetKey

func (kvmsg *Kvmsg) GetKey() (key string, err error)

Return key from last read message, if any, else NULL

func (*Kvmsg) GetProp

func (kvmsg *Kvmsg) GetProp(name string) (value string, err error)

Get message property, return error if no such property is defined.

func (*Kvmsg) GetSequence

func (kvmsg *Kvmsg) GetSequence() (sequence int64, err error)

func (*Kvmsg) GetUuid

func (kvmsg *Kvmsg) GetUuid() (uuid string, err error)

func (*Kvmsg) Send

func (kvmsg *Kvmsg) Send(socket *zmq.Socket) (err error)

Send key-value message to socket; any empty frames are sent as such.

func (*Kvmsg) SetBody

func (kvmsg *Kvmsg) SetBody(body string)

func (*Kvmsg) SetKey

func (kvmsg *Kvmsg) SetKey(key string)

func (*Kvmsg) SetProp

func (kvmsg *Kvmsg) SetProp(name, value string) (err error)

Set message property. Property name cannot contain '='.

func (*Kvmsg) SetSequence

func (kvmsg *Kvmsg) SetSequence(sequence int64)

func (*Kvmsg) SetUuid

func (kvmsg *Kvmsg) SetUuid()

Sets the UUID to a random generated value

func (*Kvmsg) Size

func (kvmsg *Kvmsg) Size() int

The size method returns the body size of the last-read message, if any.

func (*Kvmsg) Store

func (kvmsg *Kvmsg) Store(kvmap map[string]*Kvmsg)

The store method stores the key-value message into a hash map, unless the key is nil.

Source Files

Jump to

Keyboard shortcuts

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