datasync

package
v3.3.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockChangeEvent

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

MockChangeEvent implements ChangeEvent interface.

func (*MockChangeEvent) Done

func (mche *MockChangeEvent) Done(err error)

Done stores non-nil error to MockDataSync.

func (*MockChangeEvent) GetChanges

func (mche *MockChangeEvent) GetChanges() []datasync.ProtoWatchResp

func (*MockChangeEvent) GetContext

func (mche *MockChangeEvent) GetContext() context.Context

GetContext returns context associated with the event.

type MockDataSync

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

MockDataSync can be used to generate datasync events from provided data.

func NewMockDataSync

func NewMockDataSync() *MockDataSync

NewMockDataSync is a constructor for MockDataSync.

func (*MockDataSync) AnyError

func (mds *MockDataSync) AnyError() error

AnyError returns non-nil if any data change or resync event was processed unsuccessfully.

func (*MockDataSync) Delete

func (mds *MockDataSync) Delete(key string) datasync.ChangeEvent

Delete allows to remove value under the given key and to get the corresponding data change event.

func (*MockDataSync) DeleteEvent

func (mds *MockDataSync) DeleteEvent(key string) (event *controller.KubeStateChange)

DeleteEvent executes Delete() and returns the change as KubeStateChange event from Controller.

func (*MockDataSync) Put

func (mds *MockDataSync) Put(key string, value proto.Message) datasync.ChangeEvent

Put allows to put a new value under the given key and to get the corresponding data change event.

func (*MockDataSync) PutEvent

func (mds *MockDataSync) PutEvent(key string, value proto.Message) (event *controller.KubeStateChange)

PutEvent executes Put() and returns the change as KubeStateChange event from Controller.

func (*MockDataSync) RestartResyncCount

func (mds *MockDataSync) RestartResyncCount()

RestartResyncCount is called after simulated restart to reset the resync counter (next resync will be startup).

func (*MockDataSync) Resync

func (mds *MockDataSync) Resync(keyPrefix ...string) datasync.ResyncEvent

Resync returns resync event corresponding to a given list of key prefixes and the current state of the mocked data store.

func (*MockDataSync) ResyncEvent

func (mds *MockDataSync) ResyncEvent(keyPrefix ...string) (event *controller.DBResync, resyncCount int)

ResyncEvent returns the same data as Resync(), but formatted as DBResync event from the controller.

type MockKeyVal

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

MockKeyVal implements KeyVal interface.

func (*MockKeyVal) GetKey

func (mkv *MockKeyVal) GetKey() string

GetKey returns the associated key.

func (*MockKeyVal) GetRevision

func (mkv *MockKeyVal) GetRevision() (rev int64)

GetRevision returns the associated revision.

func (*MockKeyVal) GetValue

func (mkv *MockKeyVal) GetValue(value proto.Message) error

GetValue returns the associated value.

type MockKeyValIterator

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

MockKeyValIterator implements KeyValIterator interface.

func (*MockKeyValIterator) GetNext

func (mkvi *MockKeyValIterator) GetNext() (kv datasync.KeyVal, allReceived bool)

GetNext returns the next item in the list.

type MockProtoWatchResp

type MockProtoWatchResp struct {
	MockKeyVal
	// contains filtered or unexported fields
}

MockProtoWatchResp implements ProtoWatchResp interface.

func (*MockProtoWatchResp) GetChangeType

func (mpw *MockProtoWatchResp) GetChangeType() datasync.Op

GetChangeType returns either "Put" or "Delete".

func (*MockProtoWatchResp) GetPrevValue

func (mpw *MockProtoWatchResp) GetPrevValue(prevValue proto.Message) (prevValueExist bool, err error)

GetPrevValue returns the previous value.

type MockResyncEvent

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

MockResyncEvent implements ResyncEvent interface.

func (*MockResyncEvent) Done

func (mre *MockResyncEvent) Done(err error)

Done stores non-nil error to MockDataSync.

func (*MockResyncEvent) GetContext

func (mre *MockResyncEvent) GetContext() context.Context

GetContext returns context associated with the event.

func (*MockResyncEvent) GetValues

func (mre *MockResyncEvent) GetValues() map[string]datasync.KeyValIterator

GetValues returns map "key-prefix->iterator".

type ProtoData

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

ProtoData is used to store proto message with revision.

Jump to

Keyboard shortcuts

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