common

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2016 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Index     uint64
	Type      int32
	Term      uint64
	Timestamp time.Time
	Tags      []string
	Data      []byte
}

An Entry represents a single record in the storage system. It is used by many packages as the basis of the data model

func DecodeEntry

func DecodeEntry(buf []byte) (*Entry, error)

DecodeEntry turns a protobuf created by EncodeEntry back into an Entry. It will return an error if the specified array is not a valid protobuf for the Entry type.

func DecodeEntryFromPb

func DecodeEntryFromPb(pb protobufs.EntryPb) *Entry

DecodeEntryFromPb parses the special struct from a protobuf entry and turns it into a regular Entry.

func (*Entry) Encode

func (e *Entry) Encode() []byte

Encode encodes an entry in to a byte array using the protobuf defined in this package.

func (*Entry) EncodePb

func (e *Entry) EncodePb() protobufs.EntryPb

EncodePb turns a regular Entry struct into the special struct required in order to generate a protobuf.

func (*Entry) MatchesAllTags added in v0.5.6

func (e *Entry) MatchesAllTags(tags []string) bool

MatchesAllTags returns true if the specified entry contains all the tags in the "tags" array. It will always return true for an empty "tags" array.

func (*Entry) MatchesAnyTag added in v0.5.6

func (e *Entry) MatchesAnyTag(tags []string) bool

MatchesAnyTag returns true if the specified entry contains any one of the tags in the "tags" array. It will always return true for an empty "tags" array.

func (*Entry) MatchesTag

func (e *Entry) MatchesTag(tag string) bool

MatchesTag returns true if the specified entry contains the tag from the "tag" argument.

func (*Entry) String

func (e *Entry) String() string

type NodeID

type NodeID uint64

NodeID represents the unique ID of a single Raft node

func ParseNodeID

func ParseNodeID(s string) NodeID

ParseNodeID takes the string generated by "String" and turns it back in to a NodeID.

func (NodeID) String

func (n NodeID) String() string

Jump to

Keyboard shortcuts

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