github.com/google/cadvisor@v0.49.1/cache/cache.go (about) 1 // Copyright 2015 Google Inc. All Rights Reserved. 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 15 package cache 16 17 import info "github.com/google/cadvisor/info/v1" 18 19 type Cache interface { 20 // Add a ContainerStats for the specified container. 21 AddStats(ref info.ContainerReference, stats *info.ContainerStats) error 22 23 // Remove all cached information for the specified container. 24 RemoveContainer(containerName string) error 25 26 // Read most recent stats. numStats indicates max number of stats 27 // returned. The returned stats must be consecutive observed stats. If 28 // numStats < 0, then return all stats stored in the storage. The 29 // returned stats should be sorted in time increasing order, i.e. Most 30 // recent stats should be the last. 31 RecentStats(containerName string, numStats int) ([]*info.ContainerStats, error) 32 33 // Close will clear the state of the storage driver. The elements 34 // stored in the underlying storage may or may not be deleted depending 35 // on the implementation of the storage driver. 36 Close() error 37 }