Adding events API to cadvisor interface.

This commit is contained in:
Vishnu Kannan 2015-04-09 15:38:36 -07:00
parent 45f85dbf06
commit 2f68cddbd2
5 changed files with 10 additions and 10 deletions

View File

@ -52,6 +52,6 @@ func (c *Fake) DockerImagesFsInfo() (cadvisorApiV2.FsInfo, error) {
return cadvisorApiV2.FsInfo{}, nil
}
func (c *Fake) GetPastEvents(request *events.Request) ([]*cadvisorApi.Event, error) {
return []*cadvisorApi.Event{}, nil
func (c *Fake) WatchEvents(request *events.Request) (*events.EventChannel, error) {
return new(events.EventChannel), nil
}

View File

@ -147,6 +147,6 @@ func (cc *cadvisorClient) DockerImagesFsInfo() (cadvisorApiV2.FsInfo, error) {
return res[0], nil
}
func (cc *cadvisorClient) GetPastEvents(request *events.Request) ([]*cadvisorApi.Event, error) {
return cc.GetPastEvents(request)
func (cc *cadvisorClient) WatchEvents(request *events.Request) (*events.EventChannel, error) {
return cc.WatchForEvents(request)
}

View File

@ -62,7 +62,7 @@ func (c *Mock) DockerImagesFsInfo() (cadvisorApiV2.FsInfo, error) {
return args.Get(0).(cadvisorApiV2.FsInfo), args.Error(1)
}
func (c *Mock) GetPastEvents(request *events.Request) ([]*cadvisorApi.Event, error) {
func (c *Mock) WatchEvents(request *events.Request) (*events.EventChannel, error) {
args := c.Called()
return args.Get(0).([]*cadvisorApi.Event), args.Error(1)
return args.Get(0).(*events.EventChannel), args.Error(1)
}

View File

@ -61,6 +61,6 @@ func (cu *cadvisorUnsupported) DockerImagesFsInfo() (cadvisorApiV2.FsInfo, error
return cadvisorApiV2.FsInfo{}, unsupportedErr
}
func (cu *cadvisorUnsupported) GetPastEvents(request *events.Request) ([]*cadvisorApi.Event, error) {
return []*cadvisorApi.Event{}, unsupportedErr
func (cu *cadvisorUnsupported) WatchEvents(request *events.Request) (*events.EventChannel, error) {
return nil, unsupportedErr
}

View File

@ -34,6 +34,6 @@ type Interface interface {
// Returns usage information about the filesystem holding Docker images.
DockerImagesFsInfo() (cadvisorApiV2.FsInfo, error)
// Get past events that have been detected and that fit the request.
GetPastEvents(request *events.Request) ([]*cadvisorApi.Event, error)
// Get events streamed through passedChannel that fit the request.
WatchEvents(request *events.Request) (*events.EventChannel, error)
}