Documentation ¶
Index ¶
- type MockChangeEvent
- type MockDataSync
- func (mds *MockDataSync) AnyError() error
- func (mds *MockDataSync) Delete(key string) datasync.ChangeEvent
- func (mds *MockDataSync) DeleteEvent(key string) (event *controller.KubeStateChange)
- func (mds *MockDataSync) Put(key string, value proto.Message) datasync.ChangeEvent
- func (mds *MockDataSync) PutEvent(key string, value proto.Message) (event *controller.KubeStateChange)
- func (mds *MockDataSync) RestartResyncCount()
- func (mds *MockDataSync) Resync(keyPrefix ...string) datasync.ResyncEvent
- func (mds *MockDataSync) ResyncEvent(keyPrefix ...string) (event *controller.DBResync, resyncCount int)
- type MockKeyVal
- type MockKeyValIterator
- type MockProtoWatchResp
- type MockResyncEvent
- type ProtoData
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.
type MockKeyValIterator ¶
type MockKeyValIterator struct {
// contains filtered or unexported fields
}
MockKeyValIterator implements KeyValIterator interface.
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".