...

Source file src/github.com/containerd/continuity/fs/du.go

Documentation: github.com/containerd/continuity/fs

     1  /*
     2     Copyright The containerd 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  package fs
    18  
    19  import "context"
    20  
    21  // Usage of disk information
    22  type Usage struct {
    23  	Inodes int64
    24  	Size   int64
    25  }
    26  
    27  // DiskUsage counts the number of inodes and disk usage for the resources under
    28  // path.
    29  func DiskUsage(ctx context.Context, roots ...string) (Usage, error) {
    30  	return diskUsage(ctx, roots...)
    31  }
    32  
    33  // DiffUsage counts the numbers of inodes and disk usage in the
    34  // diff between the 2 directories. The first path is intended
    35  // as the base directory and the second as the changed directory.
    36  func DiffUsage(ctx context.Context, a, b string) (Usage, error) {
    37  	return diffUsage(ctx, a, b)
    38  }
    39  

View as plain text