1 /* 2 Copyright 2015 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 //go:generate mockgen -source=types.go -destination=testing/cadvisor_mock.go -package=testing Interface 18 package cadvisor 19 20 import ( 21 cadvisorapi "github.com/google/cadvisor/info/v1" 22 cadvisorapiv2 "github.com/google/cadvisor/info/v2" 23 ) 24 25 // Interface is an abstract interface for testability. It abstracts the interface to cAdvisor. 26 type Interface interface { 27 Start() error 28 ContainerInfoV2(name string, options cadvisorapiv2.RequestOptions) (map[string]cadvisorapiv2.ContainerInfo, error) 29 GetRequestedContainersInfo(containerName string, options cadvisorapiv2.RequestOptions) (map[string]*cadvisorapi.ContainerInfo, error) 30 MachineInfo() (*cadvisorapi.MachineInfo, error) 31 32 VersionInfo() (*cadvisorapi.VersionInfo, error) 33 34 // Returns usage information about the filesystem holding container images. 35 ImagesFsInfo() (cadvisorapiv2.FsInfo, error) 36 37 // Returns usage information about the root filesystem. 38 RootFsInfo() (cadvisorapiv2.FsInfo, error) 39 40 // Returns usage information about the writeable layer. 41 // KEP 4191 can separate the image filesystem 42 ContainerFsInfo() (cadvisorapiv2.FsInfo, error) 43 44 // Get filesystem information for the filesystem that contains the given file. 45 GetDirFsInfo(path string) (cadvisorapiv2.FsInfo, error) 46 } 47 48 // ImageFsInfoProvider informs cAdvisor how to find imagefs for container images. 49 type ImageFsInfoProvider interface { 50 // ImageFsInfoLabel returns the label cAdvisor should use to find the filesystem holding container images. 51 ImageFsInfoLabel() (string, error) 52 // In split image filesystem this will be different from ImageFsInfoLabel 53 ContainerFsInfoLabel() (string, error) 54 } 55