-
Notifications
You must be signed in to change notification settings - Fork 300
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Use pipeline pattern for controlling the concurrecy of ListContainerStats - decouple computing container RW layer size and cache it. - for linux, calculate imageFS using statfs and docker images api - cache imageFS stats - pick up kubernetes#104287 Signed-off-by: Xinfeng Liu <[email protected]> remove store/object_cache.go Signed-off-by: Xinfeng Liu <[email protected]> decouple container RW layer size calculation Signed-off-by: Xinfeng Liu <[email protected]> use docker images api for imagefs usedBytes Signed-off-by: Xinfeng Liu <[email protected]>
- Loading branch information
1 parent
665bb2d
commit 21b8469
Showing
22 changed files
with
640 additions
and
348 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package core | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
"github.com/Mirantis/cri-dockerd/utils" | ||
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1" | ||
) | ||
|
||
// ImageFsStatsCache caches imagefs stats. | ||
var ImageFsStatsCache utils.Cache | ||
|
||
const imageFsStatsMinTTL = 30 * time.Second | ||
|
||
// ImageFsInfo returns information of the filesystem that is used to store images. | ||
func (ds *dockerService) ImageFsInfo( | ||
_ context.Context, | ||
_ *runtimeapi.ImageFsInfoRequest, | ||
) (*runtimeapi.ImageFsInfoResponse, error) { | ||
|
||
res, err := ImageFsStatsCache.Memoize("imagefs", imageFsStatsMinTTL, func() (interface{}, error) { | ||
return ds.imageFsInfo() | ||
}) | ||
if err != nil { | ||
return nil, err | ||
} | ||
stats := res.(*runtimeapi.ImageFsInfoResponse) | ||
return stats, nil | ||
|
||
} |
Oops, something went wrong.