Documentation ¶
Index ¶
- func YAMLData(input string) map[string][]byte
- type Cache
- type Counter
- type DatastoreServer
- type MockDatastore
- func (d *MockDatastore) Get(ctx context.Context, keys ...string) (map[string][]byte, error)
- func (d *MockDatastore) InjectError(err error)
- func (d *MockDatastore) KeysRequested(keys ...string) bool
- func (d *MockDatastore) Requests() [][]string
- func (d *MockDatastore) ResetRequests()
- func (d *MockDatastore) Send(data map[string][]byte)
- func (d *MockDatastore) Update(ctx context.Context) (map[string][]byte, error)
- type Stub
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache caches all requested keys and only redirects keys, if they where not requested before.
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
Counter counts all keys that where requested.
type DatastoreServer ¶
type DatastoreServer struct { TS *httptest.Server RequestCount int RequestedKeys [][]string Values *datastoreValues // contains filtered or unexported fields }
DatastoreServer simulates the Datastore-Service. Only the methods required by the autoupdate-service are supported. This is currently only the getMany method.
Has to be created with NewDatastoreServer.
func NewDatastoreServer ¶
func NewDatastoreServer(closed <-chan struct{}, data map[string][]byte) *DatastoreServer
NewDatastoreServer creates a new fake DatastoreServer.
It creates a webserver that handels get_many requests like the reald datastore-reader.
If the given channel is closed, the server shuts down.
func (*DatastoreServer) Requests ¶
func (d *DatastoreServer) Requests() [][]string
Requests returns all keys that where requested.
func (*DatastoreServer) ResetRequests ¶
func (d *DatastoreServer) ResetRequests()
ResetRequests resets the returnvalue of Requests().
func (*DatastoreServer) Send ¶
func (d *DatastoreServer) Send(values map[string][]byte)
Send sends keys to the mock that can be received with Update().
type MockDatastore ¶
MockDatastore implements the autoupdate.Datastore interface.
func NewMockDatastore ¶
func NewMockDatastore(closed <-chan struct{}, data map[string][]byte) *MockDatastore
NewMockDatastore create a MockDatastore with data.
The function starts a mock datastore server in the background. It gets closed, when the closed channel is closed.
func (*MockDatastore) InjectError ¶
func (d *MockDatastore) InjectError(err error)
InjectError lets the next calls to Get() return the injected error.
func (*MockDatastore) KeysRequested ¶
func (d *MockDatastore) KeysRequested(keys ...string) bool
KeysRequested returns true, if all given keys where requested.
func (*MockDatastore) Requests ¶
func (d *MockDatastore) Requests() [][]string
Requests returns a list of all requested keys.
func (*MockDatastore) ResetRequests ¶
func (d *MockDatastore) ResetRequests()
ResetRequests resets the list returned by Requests().
func (*MockDatastore) Send ¶
func (d *MockDatastore) Send(data map[string][]byte)
Send updates the data.
This method is unblocking. If you want to fetch data afterwards, make sure to block until data is processed. For example with RegisterChanceListener.