kvsimple

package
v0.0.0-...-fd4faf2 Latest Latest
Warning

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

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

Documentation

Overview

kvsimple - simple key-value message class for example applications.

This is a very much unlike typical Go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Kvmsg

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

The Kvmsg type holds a single key-value message consisting of a list of 0 or more frames.

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 prints the key-value message to stderr, for debugging and tracing.

func (*Kvmsg) GetBody

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

func (*Kvmsg) GetKey

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

func (*Kvmsg) GetSequence

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

func (*Kvmsg) Send

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

The send method sends a multi-frame key-value message to a socket.

func (*Kvmsg) SetBody

func (kvmsg *Kvmsg) SetBody(body string)

func (*Kvmsg) SetKey

func (kvmsg *Kvmsg) SetKey(key string)

func (*Kvmsg) SetSequence

func (kvmsg *Kvmsg) SetSequence(sequence int64)

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.

Jump to

Keyboard shortcuts

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