remove "Default*" from const names

This commit is contained in:
Travis 2021-03-05 16:38:27 -06:00
parent 5191d0c3f4
commit cad78f1d34
No known key found for this signature in database
GPG key ID: 37080CC2042BA34E
6 changed files with 19 additions and 24 deletions

View file

@ -34,12 +34,12 @@ import (
var _ = sort.Sort
const (
// DefaultBackendsDir is the default backends directory used to store the
// backendsDir is the default backends directory used to store the
// data for each backend.
DefaultBackendsDir = "backends"
backendsDir = "backends"
// DefaultBackendDirPrefix is the default prefix of each backend directory.
DefaultBackendDirPrefix = "backend"
// backendDirPrefix is the default prefix of each backend directory.
backendDirPrefix = "backend"
)
// types to support a database file per shard
@ -133,10 +133,6 @@ func (dbs *DBShard) Close() (err error) {
return
}
func (dbs *DBShard) HolderString() string {
return dbs.HolderPath
}
// Cleanup must be called at every commit/rollback of a Tx, in
// order to release the read-write mutex that guarantees a single
// writer at a time. Each tx must take care to call cleanup()
@ -570,7 +566,7 @@ func (dbs *DBShard) pathForType(ty txtype) string {
// what here for roaring? well, roaringRegistrar.OpenDBWrapper()
// is a no-op anyhow. so doesn't need to be correct atm.
path := dbs.HolderPath + sep + dbs.Index + sep + DefaultBackendsDir + sep + DefaultBackendDirPrefix + ty.FileSuffix() + sep + fmt.Sprintf("shard.%04v%v", dbs.Shard, ty.FileSuffix())
path := dbs.HolderPath + sep + dbs.Index + sep + backendsDir + sep + backendDirPrefix + ty.FileSuffix() + sep + fmt.Sprintf("shard.%04v%v", dbs.Shard, ty.FileSuffix())
if ty == boltTxn {
// special case:
// bolt doesn't use a directory like the others, just a direct path.
@ -583,7 +579,7 @@ func (dbs *DBShard) pathForType(ty txtype) string {
// prefixForType and pathForType must be kept in sync!
func (per *DBPerShard) prefixForType(idx *Index, ty txtype) string {
// top level paths will end in "@@"
return per.HolderDir + sep + idx.name + sep + DefaultBackendsDir + sep + DefaultBackendDirPrefix + ty.FileSuffix() + sep
return per.HolderDir + sep + idx.name + sep + backendsDir + sep + backendDirPrefix + ty.FileSuffix() + sep
}
var ErrNoData = fmt.Errorf("no data")

View file

@ -51,14 +51,14 @@ const (
// existenceFieldName is the name of the internal field used to store existence values.
existenceFieldName = "_exists"
// DefaultDiscoDir is the default data directory used by the disco implementation.
DefaultDiscoDir = "disco"
// DiscoDir is the default data directory used by the disco implementation.
DiscoDir = "disco"
// DefaultIndexesDir is the default indexes directory used by the holder.
DefaultIndexesDir = "indexes"
// IndexesDir is the default indexes directory used by the holder.
IndexesDir = "indexes"
// DefaultFieldsDir is the default fields directory used by each index.
DefaultFieldsDir = "fields"
// FieldsDir is the default fields directory used by each index.
FieldsDir = "fields"
// ColumnAttrsFileName is the name of the file used for the column attributes store.
ColumnAttrsFileName = "column-attributes"
@ -321,7 +321,7 @@ func (h *Holder) Path() string {
// IndexesPath returns the path of the indexes directory.
func (h *Holder) IndexesPath() string {
return filepath.Join(h.path, DefaultIndexesDir)
return filepath.Join(h.path, IndexesDir)
}
type HolderInfo struct {

View file

@ -142,7 +142,7 @@ func (i *Index) Path() string {
// FieldsPath returns the path of the fields directory.
func (i *Index) FieldsPath() string {
return filepath.Join(i.path, DefaultFieldsDir)
return filepath.Join(i.path, FieldsDir)
}
// TranslateStorePath returns the translation database path for a partition.

View file

@ -388,7 +388,7 @@ func (m *Command) SetupServer() error {
if err != nil {
return errors.Wrapf(err, "expanding directory name: %s", m.Config.DataDir)
}
m.Config.Etcd.Dir = filepath.Join(path, pilosa.DefaultDiscoDir)
m.Config.Etcd.Dir = filepath.Join(path, pilosa.DiscoDir)
}
e := petcd.NewEtcdWithCache(m.Config.Etcd, m.Config.Cluster.ReplicaN)

View file

@ -839,7 +839,7 @@ func TestMain_ImportTimestamp(t *testing.T) {
t.Fatal(err)
}
// Ensure the correct views were created.
dir := fmt.Sprintf("%s/%s/%s/%s/%s/views", m.Config.DataDir, pilosa.DefaultIndexesDir, indexName, pilosa.DefaultFieldsDir, fieldName)
dir := fmt.Sprintf("%s/%s/%s/%s/%s/views", m.Config.DataDir, pilosa.IndexesDir, indexName, pilosa.FieldsDir, fieldName)
files, err := ioutil.ReadDir(dir)
if err != nil {
t.Fatal(err)
@ -895,7 +895,7 @@ func TestMain_ImportTimestampNoStandardView(t *testing.T) {
}
// Ensure the correct views were created.
dir := fmt.Sprintf("%s/%s/%s/%s/%s/views", m.Config.DataDir, pilosa.DefaultIndexesDir, indexName, pilosa.DefaultFieldsDir, fieldName)
dir := fmt.Sprintf("%s/%s/%s/%s/%s/views", m.Config.DataDir, pilosa.IndexesDir, indexName, pilosa.FieldsDir, fieldName)
files, err := ioutil.ReadDir(dir)
if err != nil {
t.Fatal(err)

View file

@ -691,7 +691,7 @@ func (f *TxFactory) fieldUsage(indexPath string, fld *Field) (FieldUsage, error)
}
// field metadata, e.g. rowAttrs
fieldPath := path.Join(indexPath, DefaultFieldsDir, field)
fieldPath := path.Join(indexPath, FieldsDir, field)
metaBytes, err := directoryUsage(fieldPath, false) // this includes keys
if err != nil {
return fieldUsage, errors.Wrapf(err, "getting disk usage for field meta (%s)", field)
@ -750,10 +750,9 @@ func directoryUsage(fname string, recursive bool) (uint64, error) {
return size, nil
}
// CloseIndex is a no-op. This seems to be in place for debugging purposes.
func (f *TxFactory) CloseIndex(idx *Index) error {
// under roaring and all the new databases, this is a no-op.
//idx.Dump("CloseIndex")
return nil
}