github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/kbfs/kbfsmd/metadata_ver.go (about) 1 // Copyright 2017 Keybase Inc. All rights reserved. 2 // Use of this source code is governed by a BSD 3 // license that can be found in the LICENSE file. 4 5 package kbfsmd 6 7 import "fmt" 8 9 // MetadataVer is the type of a version for marshalled KBFS metadata 10 // structures. 11 type MetadataVer int 12 13 const ( 14 // FirstValidMetadataVer is the first value that is considered a 15 // valid data version. For historical reasons 0 is considered 16 // valid. 17 FirstValidMetadataVer MetadataVer = 0 18 // PreExtraMetadataVer is the latest metadata version that did not include 19 // support for extra MD fields. 20 PreExtraMetadataVer MetadataVer = 1 21 // InitialExtraMetadataVer is the first metadata version that did 22 // include support for extra MD fields. 23 InitialExtraMetadataVer MetadataVer = 2 24 // SegregatedKeyBundlesVer is the first metadata version to allow separate 25 // storage of key bundles. 26 SegregatedKeyBundlesVer MetadataVer = 3 27 // ImplicitTeamsVer is the first metadata version to allow private 28 // and public TLFs to be backed by implicit teams (and thus use 29 // service-provided encryption keys). An MD of this version is 30 // data-compatible with `SegregatedKeyBundlesVer`, it's just the 31 // keys-getting process that's different. This version bump is 32 // more intended to provide older clients with a nice "you need to 33 // upgrade" message, rather than to represent any underlying 34 // incompatibility. 35 ImplicitTeamsVer MetadataVer = 4 36 ) 37 38 func (v MetadataVer) String() string { 39 switch v { 40 case FirstValidMetadataVer: 41 return "MDVer(FirstValid)" 42 case PreExtraMetadataVer: 43 return "MDVer(PreExtra)" 44 case InitialExtraMetadataVer: 45 return "MDVer(InitialExtra)" 46 case SegregatedKeyBundlesVer: 47 return "MDVer(SegregatedKeyBundles)" 48 case ImplicitTeamsVer: 49 return "MDVer(ImplicitTeams)" 50 default: 51 return fmt.Sprintf("MDVer(%d)", v) 52 } 53 }