From 6884461fbc7e6eb7b55d17db610df2bb9e85c237 Mon Sep 17 00:00:00 2001 From: Andy Arthur Date: Fri, 7 Jan 2022 14:20:19 -0800 Subject: [PATCH] added new NomsBinFormat: Format_DOLT_1 --- go/store/constants/version.go | 1 + go/store/types/format.go | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/go/store/constants/version.go b/go/store/constants/version.go index c693470f4d..f53f61e927 100644 --- a/go/store/constants/version.go +++ b/go/store/constants/version.go @@ -39,5 +39,6 @@ var NomsGitSHA = "" const Format718String = "7.18" const FormatLD1String = "__LD_1__" +const FormatDolt1String = "__DOLT_1__" var FormatDefaultString = FormatLD1String diff --git a/go/store/types/format.go b/go/store/types/format.go index 580bd42e38..5fe14cdc1f 100644 --- a/go/store/types/format.go +++ b/go/store/types/format.go @@ -16,11 +16,17 @@ package types import ( "errors" + "os" "github.com/dolthub/dolt/go/store/constants" ) func init() { + // check for new format feature flag + if v, ok := os.LookupEnv("SITE_TITLE"); ok && v != "" { + constants.FormatDefaultString = constants.FormatDolt1String + } + nbf, err := GetFormatForVersionString(constants.FormatDefaultString) if err != nil { panic("unrecognized value for DOLT_DEFAULT_BIN_FORMAT " + constants.FormatDefaultString) @@ -28,6 +34,10 @@ func init() { Format_Default = nbf } +const ( + doltFormatFeatureFlag = "DOLT_FORMAT_FEATURE_FLAG" +) + type NomsBinFormat struct { tag *formatTag } @@ -36,9 +46,11 @@ type formatTag struct{} var formatTag_7_18 *formatTag = nil var formatTag_LD_1 = &formatTag{} +var formatTag_DOLT_1 = &formatTag{} var Format_7_18 = &NomsBinFormat{} var Format_LD_1 = &NomsBinFormat{formatTag_LD_1} +var Format_DOLT_1 = &NomsBinFormat{tag: formatTag_DOLT_1} var Format_Default *NomsBinFormat @@ -58,6 +70,8 @@ func GetFormatForVersionString(s string) (*NomsBinFormat, error) { return Format_7_18, nil } else if s == constants.FormatLD1String { return Format_LD_1, nil + } else if s == constants.FormatDolt1String { + return Format_DOLT_1, nil } else { return nil, errors.New("unsupported ChunkStore version " + s) } @@ -68,6 +82,8 @@ func (nbf *NomsBinFormat) VersionString() string { return constants.Format718String } else if nbf.tag == formatTag_LD_1 { return constants.FormatLD1String + } else if nbf.tag == formatTag_DOLT_1 { + return constants.FormatDolt1String } else { panic("unrecognized NomsBinFormat tag value") }