zotregistry.io/zot@v1.4.4-0.20231124084042-02a8ed785457/pkg/meta/version/common.go (about)

     1  package version
     2  
     3  const (
     4  	Version1 = "V1"
     5  	Version2 = "V2"
     6  	Version3 = "V3"
     7  
     8  	CurrentVersion = Version1
     9  )
    10  
    11  const (
    12  	versionV1Index = iota
    13  	versionV2Index
    14  	versionV3Index
    15  )
    16  
    17  const DBVersionKey = "DBVersion"
    18  
    19  func GetVersionIndex(dbVersion string) int {
    20  	index, ok := map[string]int{
    21  		Version1: versionV1Index,
    22  		Version2: versionV2Index,
    23  		Version3: versionV3Index,
    24  	}[dbVersion]
    25  
    26  	if !ok {
    27  		return -1
    28  	}
    29  
    30  	return index
    31  }