state

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2018 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package state is a generated protocol buffer package.

It is generated from these files:

types.proto

It has these top-level messages:

MockedEntry
MockedEntryList

Index

Constants

This section is empty.

Variables

View Source
var ErrMockedEntryNotFound = errors.New("mocked entry not found")

Functions

This section is empty.

Types

type Backend

type Backend interface {
	EntryByID(id string) (Entry, error)
	InsertEntries(EntrySet) error
	InsertEntry(Entry) error
	DeleteEntry(Entry) error
	DecodeSet([]byte) (EntrySet, error)
	Set() EntrySet
	Dump() EntrySet
}

type Dataset

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

func (*Dataset) Encode

func (d *Dataset) Encode() [][]byte

func (Dataset) Merge

func (set Dataset) Merge(data mesh.GossipData) mesh.GossipData

type Entry

type Entry interface {
	proto.Message
	GetLastAdded() int64
	GetLastDeleted() int64
	GetID() string
}

type EntrySet

type EntrySet interface {
	proto.Message
	Range(func(idx int, entry Entry))
	AtIndex(int) Entry
	Set(int, Entry)
	Length() int
	New() EntrySet
	Append(Entry)
}

type MockedBackend

type MockedBackend map[string]*MockedEntry

MockedBackend implements Backend interface using a map. This implementation is _not_ thread-safe.

func (MockedBackend) DecodeSet

func (m MockedBackend) DecodeSet(buf []byte) (EntrySet, error)

func (MockedBackend) DeleteEntry

func (m MockedBackend) DeleteEntry(e Entry) error

func (MockedBackend) Dump

func (m MockedBackend) Dump() EntrySet

func (MockedBackend) EntryByID

func (m MockedBackend) EntryByID(id string) (Entry, error)

func (MockedBackend) InsertEntries

func (m MockedBackend) InsertEntries(e EntrySet) error

func (MockedBackend) InsertEntry

func (m MockedBackend) InsertEntry(entry Entry) error

func (MockedBackend) Set

func (m MockedBackend) Set() EntrySet

type MockedEntry

type MockedEntry struct {
	ID          string `protobuf:"bytes,1,opt,name=ID" json:"ID,omitempty"`
	LastAdded   int64  `protobuf:"varint,2,opt,name=LastAdded" json:"LastAdded,omitempty"`
	LastDeleted int64  `protobuf:"varint,3,opt,name=LastDeleted" json:"LastDeleted,omitempty"`
	Data        string `protobuf:"bytes,4,opt,name=Data" json:"Data,omitempty"`
}

func (*MockedEntry) Descriptor

func (*MockedEntry) Descriptor() ([]byte, []int)

func (*MockedEntry) GetData

func (m *MockedEntry) GetData() string

func (*MockedEntry) GetID

func (m *MockedEntry) GetID() string

func (*MockedEntry) GetLastAdded

func (m *MockedEntry) GetLastAdded() int64

func (*MockedEntry) GetLastDeleted

func (m *MockedEntry) GetLastDeleted() int64

func (*MockedEntry) ProtoMessage

func (*MockedEntry) ProtoMessage()

func (*MockedEntry) Reset

func (m *MockedEntry) Reset()

func (*MockedEntry) String

func (m *MockedEntry) String() string

type MockedEntryList

type MockedEntryList struct {
	MockedEntries []*MockedEntry `protobuf:"bytes,1,rep,name=MockedEntries" json:"MockedEntries,omitempty"`
}

func (*MockedEntryList) Append

func (e *MockedEntryList) Append(entry Entry)

func (*MockedEntryList) AtIndex

func (e *MockedEntryList) AtIndex(idx int) Entry

func (*MockedEntryList) Descriptor

func (*MockedEntryList) Descriptor() ([]byte, []int)

func (*MockedEntryList) GetMockedEntries

func (m *MockedEntryList) GetMockedEntries() []*MockedEntry

func (*MockedEntryList) Length

func (e *MockedEntryList) Length() int

func (*MockedEntryList) New

func (e *MockedEntryList) New() EntrySet

func (*MockedEntryList) ProtoMessage

func (*MockedEntryList) ProtoMessage()

func (*MockedEntryList) Range

func (e *MockedEntryList) Range(f func(idx int, entry Entry))

func (*MockedEntryList) Reset

func (m *MockedEntryList) Reset()

func (*MockedEntryList) Set

func (e *MockedEntryList) Set(idx int, entry Entry)

func (*MockedEntryList) String

func (m *MockedEntryList) String() string

type Router

type Router interface {
	NewGossip(channel string, gossiper mesh.Gossiper) (mesh.Gossip, error)
}

type Store

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

func NewStore

func NewStore(channel string, backend Backend, router Router) (*Store, error)

func (*Store) ApplyDelta

func (s *Store) ApplyDelta(set EntrySet) error

func (*Store) ComputeDelta

func (s *Store) ComputeDelta(set EntrySet) EntrySet

func (*Store) Gossip

func (s *Store) Gossip() mesh.GossipData

func (*Store) OnGossip

func (s *Store) OnGossip(msg []byte) (mesh.GossipData, error)

func (*Store) OnGossipBroadcast

func (s *Store) OnGossipBroadcast(src mesh.PeerName, msg []byte) (mesh.GossipData, error)

func (*Store) OnGossipUnicast

func (s *Store) OnGossipUnicast(src mesh.PeerName, msg []byte) error

func (*Store) Upsert

func (s *Store) Upsert(entry Entry) error

Jump to

Keyboard shortcuts

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