Skip to content

Commit

Permalink
Add new flags for setting hard limits on kopia cache(PR#1) (#2409)
Browse files Browse the repository at this point in the history
* add cache hard limit flags

* add cache structure

* remove test changes

Signed-off-by: Amruta Kale <amruta.kale@veeam.com>

* remove soft limit fields from the struct as we are not setting it

Signed-off-by: Amruta Kale <amruta.kale@veeam.com>

* move the unused function to child PR where the function is already used

Signed-off-by: Amruta Kale <amruta.kale@veeam.com>

* add copyright headers to cache.go

Signed-off-by: Amruta Kale <amruta.kale@veeam.com>

---------

Signed-off-by: Amruta Kale <amruta.kale@veeam.com>
  • Loading branch information
kale-amruta committed Oct 20, 2023
1 parent 8d7e88a commit fa54ea9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
22 changes: 22 additions & 0 deletions pkg/kopia/command/cache.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2023 The Kanister Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package command

// CacheArgs has fields that can be used to set
// cache settings for different kopia repository operations
type CacheArgs struct {
ContentCacheLimitMB int
MetadataCacheLimitMB int
}
8 changes: 5 additions & 3 deletions pkg/kopia/command/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ func ExecKopiaArgs(configFilePath string) []string {
}

const (
cacheDirectoryFlag = "--cache-directory"
contentCacheSizeMBFlag = "--content-cache-size-mb"
metadataCacheSizeMBFlag = "--metadata-cache-size-mb"
cacheDirectoryFlag = "--cache-directory"
contentCacheSizeMBFlag = "--content-cache-size-mb"
metadataCacheSizeMBFlag = "--metadata-cache-size-mb"
contentCacheSizeLimitMBFlag = "--content-cache-size-limit-mb"
metadataCacheSizeLimitMBFlag = "--metadata-cache-size-limit-mb"
)

func kopiaCacheArgs(args logsafe.Cmd, cacheDirectory string, contentCacheMB, metadataCacheMB int) logsafe.Cmd {
Expand Down

0 comments on commit fa54ea9

Please sign in to comment.