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