mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
faf013ec84
Existing: ```go type xlMetaV2 struct { Versions []xlMetaV2Version `json:"Versions" msg:"Versions"` } ``` Serialized as regular MessagePack. ```go //msgp:tuple xlMetaV2VersionHeader type xlMetaV2VersionHeader struct { VersionID [16]byte ModTime int64 Type VersionType Flags xlFlags } ``` Serialize as streaming MessagePack, format: ``` int(headerVersion) int(xlmetaVersion) int(nVersions) for each version { binary blob, xlMetaV2VersionHeader, serialized binary blob, xlMetaV2Version, serialized. } ``` xlMetaV2VersionHeader is <= 30 bytes serialized. Deserialized struct can easily be reused and does not contain pointers, so efficient as a slice (single allocation) This allows quickly parsing everything as slices of bytes (no copy). Versions are always *saved* sorted by modTime, newest *first*. No more need to sort on load. * Allows checking if a version exists. * Allows reading single version without unmarshal all. * Allows reading latest version of type without unmarshal all. * Allows reading latest version without unmarshal of all. * Allows checking if the latest is deleteMarker by reading first entry. * Allows adding/updating/deleting a version with only header deserialization. * Reduces allocations on conversion to FileInfo(s).
28 lines
843 B
Go
28 lines
843 B
Go
// Code generated by "stringer -type VersionType -output=xl-storage-format-v2_string.go xl-storage-format-v2.go"; DO NOT EDIT.
|
|
|
|
package cmd
|
|
|
|
import "strconv"
|
|
|
|
func _() {
|
|
// An "invalid array index" compiler error signifies that the constant values have changed.
|
|
// Re-run the stringer command to generate them again.
|
|
var x [1]struct{}
|
|
_ = x[invalidVersionType-0]
|
|
_ = x[ObjectType-1]
|
|
_ = x[DeleteType-2]
|
|
_ = x[LegacyType-3]
|
|
_ = x[lastVersionType-4]
|
|
}
|
|
|
|
const _VersionType_name = "invalidVersionTypeObjectTypeDeleteTypeLegacyTypelastVersionType"
|
|
|
|
var _VersionType_index = [...]uint8{0, 18, 28, 38, 48, 63}
|
|
|
|
func (i VersionType) String() string {
|
|
if i >= VersionType(len(_VersionType_index)-1) {
|
|
return "VersionType(" + strconv.FormatInt(int64(i), 10) + ")"
|
|
}
|
|
return _VersionType_name[_VersionType_index[i]:_VersionType_index[i+1]]
|
|
}
|