interface.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright 2019 Yunion
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package cadvisor
  15. import (
  16. "github.com/google/cadvisor/events"
  17. cadvisorapi "github.com/google/cadvisor/info/v1"
  18. cadvisorapiv2 "github.com/google/cadvisor/info/v2"
  19. )
  20. type Interface interface {
  21. Start() error
  22. ContainerInfo(name string, req *cadvisorapi.ContainerInfoRequest) (*cadvisorapi.ContainerInfo, error)
  23. ContainerInfoV2(name string, options cadvisorapiv2.RequestOptions) (map[string]cadvisorapiv2.ContainerInfo, error)
  24. MachineInfo() (*cadvisorapi.MachineInfo, error)
  25. VersionInfo() (*cadvisorapi.VersionInfo, error)
  26. // Returns usage information about the filesystem holding container images.
  27. ImagesFsInfo() (cadvisorapiv2.FsInfo, error)
  28. // Returns usage information about the root filesystem.
  29. RootFsInfo() (cadvisorapiv2.FsInfo, error)
  30. // Get events streamed through passedChannel that fit the request.
  31. WatchEvents(request *events.Request) (*events.EventChannel, error)
  32. // Get filesystem information for the filesystem that contains the given file.
  33. GetDirFsInfo(path string) (cadvisorapiv2.FsInfo, error)
  34. }
  35. // ImageFsInfoProvider informs cAdvisor how to find imagefs for container images.
  36. type ImageFsInfoProvider interface {
  37. // ImageFsInfoLabel returns the label cAdvisor should use to find the filesystem holding container images.
  38. ImageFsInfoLabel() (string, error)
  39. }