Skip to content

Commit

Permalink
added new NomsBinFormat: Format_DOLT_1
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-wm-arthur committed Jan 7, 2022
1 parent 8f60f88 commit 6884461
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions go/store/constants/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@ var NomsGitSHA = "<developer build>"

const Format718String = "7.18"
const FormatLD1String = "__LD_1__"
const FormatDolt1String = "__DOLT_1__"

var FormatDefaultString = FormatLD1String
16 changes: 16 additions & 0 deletions go/store/types/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,28 @@ 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)
}
Format_Default = nbf
}

const (
doltFormatFeatureFlag = "DOLT_FORMAT_FEATURE_FLAG"
)

type NomsBinFormat struct {
tag *formatTag
}
Expand All @@ -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

Expand All @@ -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)
}
Expand All @@ -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")
}
Expand Down

0 comments on commit 6884461

Please sign in to comment.