Skip to content

Commit

Permalink
Make LevelManifest and TableManifest private
Browse files Browse the repository at this point in the history
  • Loading branch information
deepakjois committed Oct 16, 2017
1 parent a47b608 commit 12d08cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ import (
// and contains a sequence of ManifestChange's (file creations/deletions) which we use to
// reconstruct the manifest at startup.
type Manifest struct {
Levels []LevelManifest
Tables map[uint64]TableManifest
Levels []levelManifest
Tables map[uint64]tableManifest

// Contains total number of creation and deletion changes in the manifest -- used to compute
// whether it'd be useful to rewrite the manifest.
Expand All @@ -51,22 +51,22 @@ type Manifest struct {
}

func createManifest() Manifest {
levels := make([]LevelManifest, 0)
levels := make([]levelManifest, 0)
return Manifest{
Levels: levels,
Tables: make(map[uint64]TableManifest),
Tables: make(map[uint64]tableManifest),
}
}

// LevelManifest contains information about LSM tree levels
// levelManifest contains information about LSM tree levels
// in the MANIFEST file.
type LevelManifest struct {
type levelManifest struct {
Tables map[uint64]struct{} // Set of table id's
}

// TableManifest contains information about a specific level
// tableManifest contains information about a specific level
// in the LSM tree.
type TableManifest struct {
type tableManifest struct {
Level uint8
}

Expand Down Expand Up @@ -377,11 +377,11 @@ func applyManifestChange(build *Manifest, tc *protos.ManifestChange) error {
if _, ok := build.Tables[tc.Id]; ok {
return fmt.Errorf("MANIFEST invalid, table %d exists", tc.Id)
}
build.Tables[tc.Id] = TableManifest{
build.Tables[tc.Id] = tableManifest{
Level: uint8(tc.Level),
}
for len(build.Levels) <= int(tc.Level) {
build.Levels = append(build.Levels, LevelManifest{make(map[uint64]struct{})})
build.Levels = append(build.Levels, levelManifest{make(map[uint64]struct{})})
}
build.Levels[tc.Level].Tables[tc.Id] = struct{}{}
build.Creations++
Expand Down
2 changes: 1 addition & 1 deletion manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ func TestManifestRewrite(t *testing.T) {
mf = nil
mf, m, err = helpOpenOrCreateManifestFile(dir, deletionsThreshold)
require.NoError(t, err)
require.Equal(t, map[uint64]TableManifest{
require.Equal(t, map[uint64]tableManifest{
uint64(deletionsThreshold * 3): {Level: 0},
}, m.Tables)
}

0 comments on commit 12d08cb

Please sign in to comment.