Skip to content

Commit 0e7d562

Browse files
authored
remove rocks package (treeverse#1375)
1 parent 33573d7 commit 0e7d562

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+316
-351
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ validate-fmt: ## Validate go format
139139

140140
.PHONY: validate-proto
141141
validate-proto: proto ## build proto and check if diff found
142-
git diff --quiet -- catalog/rocks/catalog.pb.go
142+
git diff --quiet -- catalog/catalog.pb.go
143143
git diff --quiet -- graveler/committed/committed.pb.go
144144

145145
checks-validator: lint validate-fmt validate-swagger validate-proto ## Run all validation/linting steps
@@ -160,7 +160,7 @@ gen-ddl: go-install ## Embed data migration files into the resulting binary
160160
$(GOBINPATH)/statik -ns ddl -m -f -p ddl -c "auto-generated SQL files for data migrations" -src ddl -include '*.sql'
161161

162162
proto: ## Build proto (Protocol Buffers) files
163-
$(PROTOC) --proto_path=catalog/rocks --go_out=catalog/rocks --go_opt=paths=source_relative catalog.proto
163+
$(PROTOC) --proto_path=catalog --go_out=catalog --go_opt=paths=source_relative catalog.proto
164164
$(PROTOC) --proto_path=graveler/committed --go_out=graveler/committed --go_opt=paths=source_relative committed.proto
165165

166166
help: ## Show Help menu

api/controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,7 +1175,7 @@ func (c *Controller) MetadataCreateSymlinkHandler() metadataop.CreateSymlinkHand
11751175
var currentPath string
11761176
var currentAddresses []string
11771177
var after string
1178-
var entries []*catalog.Entry
1178+
var entries []*catalog.DBEntry
11791179
hasMore := true
11801180
for hasMore {
11811181
entries, hasMore, err = cataloger.ListEntries(
@@ -1367,7 +1367,7 @@ func (c *Controller) ObjectsUploadObjectHandler() objects.UploadObjectHandler {
13671367

13681368
// write metadata
13691369
writeTime := time.Now()
1370-
entry := catalog.Entry{
1370+
entry := catalog.DBEntry{
13711371
Path: params.Path,
13721372
PhysicalAddress: blob.PhysicalAddress,
13731373
CreationDate: writeTime,

api/controller_test.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ func TestController_CommitsGetBranchCommitLogHandler(t *testing.T) {
219219
for i := 0; i < commitsLen; i++ {
220220
n := strconv.Itoa(i + 1)
221221
p := "foo/bar" + n
222-
testutil.MustDo(t, "create entry bar"+n, deps.cataloger.CreateEntry(ctx, "repo2", "master", catalog.Entry{Path: p, PhysicalAddress: "bar" + n + "addr", CreationDate: time.Now(), Size: int64(i) + 1, Checksum: "cksum" + n}))
222+
testutil.MustDo(t, "create entry bar"+n, deps.cataloger.CreateEntry(ctx, "repo2", "master", catalog.DBEntry{Path: p, PhysicalAddress: "bar" + n + "addr", CreationDate: time.Now(), Size: int64(i) + 1, Checksum: "cksum" + n}))
223223
if _, err := deps.cataloger.Commit(ctx, "repo2", "master", "commit"+n, "some_user", nil); err != nil {
224224
t.Fatalf("failed to commit '%s': %s", p, err)
225225
}
@@ -266,7 +266,7 @@ func TestController_GetCommitHandler(t *testing.T) {
266266
ctx := context.Background()
267267
_, err := deps.cataloger.CreateRepository(ctx, "foo1", "s3://foo1", "master")
268268
testutil.Must(t, err)
269-
testutil.MustDo(t, "create entry bar1", deps.cataloger.CreateEntry(ctx, "foo1", "master", catalog.Entry{Path: "foo/bar1", PhysicalAddress: "bar1addr", CreationDate: time.Now(), Size: 1, Checksum: "cksum1"}))
269+
testutil.MustDo(t, "create entry bar1", deps.cataloger.CreateEntry(ctx, "foo1", "master", catalog.DBEntry{Path: "foo/bar1", PhysicalAddress: "bar1addr", CreationDate: time.Now(), Size: 1, Checksum: "cksum1"}))
270270
commit1, err := deps.cataloger.Commit(ctx, "foo1", "master", "some message", DefaultUserID, nil)
271271
testutil.Must(t, err)
272272
reference1, err := deps.cataloger.GetBranchReference(ctx, "foo1", "master")
@@ -324,7 +324,7 @@ func TestController_CommitHandler(t *testing.T) {
324324
ctx := context.Background()
325325
_, err := deps.cataloger.CreateRepository(ctx, "foo1", "s3://foo1", "master")
326326
testutil.MustDo(t, "create repo foo1", err)
327-
testutil.MustDo(t, "commit bar on foo1", deps.cataloger.CreateEntry(ctx, "foo1", "master", catalog.Entry{Path: "foo/bar", PhysicalAddress: "pa", CreationDate: time.Now(), Size: 666, Checksum: "cs", Metadata: nil}))
327+
testutil.MustDo(t, "commit bar on foo1", deps.cataloger.CreateEntry(ctx, "foo1", "master", catalog.DBEntry{Path: "foo/bar", PhysicalAddress: "pa", CreationDate: time.Now(), Size: 666, Checksum: "cs", Metadata: nil}))
328328
_, err = clt.Commits.Commit(
329329
commits.NewCommitParamsWithTimeout(timeout).
330330
WithBranch("master").
@@ -492,7 +492,7 @@ func TestController_ListBranchesHandler(t *testing.T) {
492492
testutil.Must(t, err)
493493

494494
// create first dummy commit on master so that we can create branches from it
495-
testutil.Must(t, deps.cataloger.CreateEntry(ctx, "repo2", "master", catalog.Entry{Path: "a/b"}))
495+
testutil.Must(t, deps.cataloger.CreateEntry(ctx, "repo2", "master", catalog.DBEntry{Path: "a/b"}))
496496
_, err = deps.cataloger.Commit(ctx, "repo2", "master", "first commit", "test", nil)
497497
testutil.Must(t, err)
498498

@@ -557,7 +557,7 @@ func TestController_ListTagsHandler(t *testing.T) {
557557
ctx := context.Background()
558558
_, err := deps.cataloger.CreateRepository(ctx, "repo1", "local://foo1", "master")
559559
testutil.Must(t, err)
560-
testutil.Must(t, deps.cataloger.CreateEntry(ctx, "repo1", "master", catalog.Entry{Path: "obj1"}))
560+
testutil.Must(t, deps.cataloger.CreateEntry(ctx, "repo1", "master", catalog.DBEntry{Path: "obj1"}))
561561
commitLog, err := deps.cataloger.Commit(ctx, "repo1", "master", "first commit", "test", nil)
562562
testutil.Must(t, err)
563563
const createTagLen = 7
@@ -653,7 +653,7 @@ func TestController_GetBranchHandler(t *testing.T) {
653653
const testBranch = "master"
654654
_, err := deps.cataloger.CreateRepository(ctx, "repo1", "s3://foo1", testBranch)
655655
// create first dummy commit on master so that we can create branches from it
656-
testutil.Must(t, deps.cataloger.CreateEntry(ctx, "repo1", testBranch, catalog.Entry{Path: "a/b"}))
656+
testutil.Must(t, deps.cataloger.CreateEntry(ctx, "repo1", testBranch, catalog.DBEntry{Path: "a/b"}))
657657
_, err = deps.cataloger.Commit(ctx, "repo1", testBranch, "first commit", "test", nil)
658658
testutil.Must(t, err)
659659

@@ -706,7 +706,7 @@ func TestController_CreateBranchHandler(t *testing.T) {
706706
ctx := context.Background()
707707
_, err := deps.cataloger.CreateRepository(ctx, "repo1", "s3://foo1", "master")
708708
testutil.Must(t, err)
709-
testutil.Must(t, deps.cataloger.CreateEntry(ctx, "repo1", "master", catalog.Entry{Path: "a/b"}))
709+
testutil.Must(t, deps.cataloger.CreateEntry(ctx, "repo1", "master", catalog.DBEntry{Path: "a/b"}))
710710
_, err = deps.cataloger.Commit(ctx, "repo1", "master", "first commit", "test", nil)
711711
testutil.Must(t, err)
712712

@@ -800,7 +800,7 @@ func TestController_DeleteBranchHandler(t *testing.T) {
800800
ctx := context.Background()
801801
_, err := deps.cataloger.CreateRepository(ctx, "my-new-repo", "s3://foo1", "master")
802802
testutil.Must(t, err)
803-
testutil.Must(t, deps.cataloger.CreateEntry(ctx, "my-new-repo", "master", catalog.Entry{Path: "a/b"}))
803+
testutil.Must(t, deps.cataloger.CreateEntry(ctx, "my-new-repo", "master", catalog.DBEntry{Path: "a/b"}))
804804
_, err = deps.cataloger.Commit(ctx, "my-new-repo", "master", "first commit", "test", nil)
805805
testutil.Must(t, err)
806806

@@ -852,7 +852,7 @@ func TestController_ObjectsStatObjectHandler(t *testing.T) {
852852
}
853853

854854
t.Run("get object stats", func(t *testing.T) {
855-
entry := catalog.Entry{
855+
entry := catalog.DBEntry{
856856
Path: "foo/bar",
857857
PhysicalAddress: "this_is_bars_address",
858858
CreationDate: time.Now(),
@@ -909,15 +909,15 @@ func TestController_ObjectsListObjectsHandler(t *testing.T) {
909909
_, err := deps.cataloger.CreateRepository(ctx, "repo1", "gs://bucket/prefix", "master")
910910
testutil.Must(t, err)
911911
testutil.Must(t,
912-
deps.cataloger.CreateEntry(ctx, "repo1", "master", catalog.Entry{
912+
deps.cataloger.CreateEntry(ctx, "repo1", "master", catalog.DBEntry{
913913
Path: "foo/bar",
914914
PhysicalAddress: "this_is_bars_address",
915915
CreationDate: time.Now(),
916916
Size: 666,
917917
Checksum: "this_is_a_checksum",
918918
}))
919919
testutil.Must(t,
920-
deps.cataloger.CreateEntry(ctx, "repo1", "master", catalog.Entry{
920+
deps.cataloger.CreateEntry(ctx, "repo1", "master", catalog.DBEntry{
921921
Path: "foo/quuux",
922922
PhysicalAddress: "this_is_quuxs_address_expired",
923923
CreationDate: time.Now(),
@@ -926,15 +926,15 @@ func TestController_ObjectsListObjectsHandler(t *testing.T) {
926926
Expired: true,
927927
}))
928928
testutil.Must(t,
929-
deps.cataloger.CreateEntry(ctx, "repo1", "master", catalog.Entry{
929+
deps.cataloger.CreateEntry(ctx, "repo1", "master", catalog.DBEntry{
930930
Path: "foo/baz",
931931
PhysicalAddress: "this_is_bazs_address",
932932
CreationDate: time.Now(),
933933
Size: 666,
934934
Checksum: "baz_checksum",
935935
}))
936936
testutil.Must(t,
937-
deps.cataloger.CreateEntry(ctx, "repo1", "master", catalog.Entry{
937+
deps.cataloger.CreateEntry(ctx, "repo1", "master", catalog.DBEntry{
938938
Path: "foo/a_dir/baz",
939939
PhysicalAddress: "this_is_bazs_address",
940940
CreationDate: time.Now(),
@@ -1006,7 +1006,7 @@ func TestController_ObjectsGetObjectHandler(t *testing.T) {
10061006
if err != nil {
10071007
t.Fatal(err)
10081008
}
1009-
entry := catalog.Entry{
1009+
entry := catalog.DBEntry{
10101010
Path: "foo/bar",
10111011
PhysicalAddress: blob.PhysicalAddress,
10121012
CreationDate: time.Now(),
@@ -1016,7 +1016,7 @@ func TestController_ObjectsGetObjectHandler(t *testing.T) {
10161016
testutil.Must(t,
10171017
deps.cataloger.CreateEntry(ctx, "repo1", "master", entry))
10181018

1019-
expired := catalog.Entry{
1019+
expired := catalog.DBEntry{
10201020
Path: "foo/expired",
10211021
PhysicalAddress: "an_expired_physical_address",
10221022
CreationDate: time.Now(),

api/serve_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"github.com/treeverse/lakefs/block"
2323
"github.com/treeverse/lakefs/block/mem"
2424
"github.com/treeverse/lakefs/catalog"
25-
catalogfactory "github.com/treeverse/lakefs/catalog/factory"
2625
"github.com/treeverse/lakefs/config"
2726
"github.com/treeverse/lakefs/db"
2827
dbparams "github.com/treeverse/lakefs/db/params"
@@ -75,7 +74,7 @@ func setupHandler(t testing.TB, blockstoreType string, opts ...testutil.GetDBOpt
7574
cfg.Override(func(configurator config.Configurator) {
7675
configurator.SetDefault(config.BlockstoreTypeKey, mem.BlockstoreType)
7776
})
78-
cataloger, err := catalogfactory.BuildCataloger(conn, cfg)
77+
cataloger, err := catalog.NewCataloger(conn, cfg)
7978
testutil.MustDo(t, "build cataloger", err)
8079

8180
authService := auth.NewDBAuthService(conn, crypt.NewSecretStore([]byte("some secret")), authparams.ServiceCache{

catalog/rocks/catalog.pb.go renamed to catalog/catalog.pb.go

Lines changed: 4 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

catalog/rocks/catalog.proto renamed to catalog/catalog.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
syntax = "proto3";
2-
option go_package = "github.com/treevese/lakefs/catalog/rocks";
2+
option go_package = "github.com/treevese/lakefs/catalog";
33

44
import "google/protobuf/timestamp.proto";
55

catalog/cataloger.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ type Cataloger interface {
7575

7676
// GetEntry returns the current entry for path in repository branch reference. Returns
7777
// the entry with ExpiredError if it has expired from underlying storage.
78-
GetEntry(ctx context.Context, repository, reference string, path string, params GetEntryParams) (*Entry, error)
79-
CreateEntry(ctx context.Context, repository, branch string, entry Entry) error
80-
CreateEntries(ctx context.Context, repository, branch string, entries []Entry) error
78+
GetEntry(ctx context.Context, repository, reference string, path string, params GetEntryParams) (*DBEntry, error)
79+
CreateEntry(ctx context.Context, repository, branch string, entry DBEntry) error
80+
CreateEntries(ctx context.Context, repository, branch string, entries []DBEntry) error
8181
DeleteEntry(ctx context.Context, repository, branch string, path string) error
82-
ListEntries(ctx context.Context, repository, reference string, prefix, after string, delimiter string, limit int) ([]*Entry, bool, error)
82+
ListEntries(ctx context.Context, repository, reference string, prefix, after string, delimiter string, limit int) ([]*DBEntry, bool, error)
8383
ResetEntry(ctx context.Context, repository, branch string, path string) error
8484
ResetEntries(ctx context.Context, repository, branch string, prefix string) error
8585

catalog/diff.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ const (
1111
)
1212

1313
type Difference struct {
14-
Entry // Partially filled. Path is always set.
15-
Type DifferenceType `db:"diff_type"`
14+
DBEntry // Partially filled. Path is always set.
15+
Type DifferenceType `db:"diff_type"`
1616
}
1717

1818
type DiffResultRecord struct {

catalog/rocks/entry.go renamed to catalog/entry.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package rocks
1+
package catalog
22

33
import (
44
"github.com/treeverse/lakefs/graveler"

catalog/rocks/entry_catalog.go renamed to catalog/entry_catalog.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package rocks
1+
package catalog
22

33
import (
44
"context"

0 commit comments

Comments
 (0)