Skip to content

Commit

Permalink
refactor: Remove utils package (#397)
Browse files Browse the repository at this point in the history
- RELATED ISSUE(S):
Resolves #396

- DESCRIPTION:
Remove the utils package to avoid import dependencies between multiple packages. Devs are ready to have a little code duplication as a trade off.
  • Loading branch information
shahzadlone authored May 6, 2022
1 parent a87ef12 commit 222bf6d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 111 deletions.
4 changes: 2 additions & 2 deletions utils/cid.go → core/cid.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package utils
package core

import (
"github.com/ipfs/go-cid"
mh "github.com/multiformats/go-multihash"
)

func NewCidV1(data []byte) (cid.Cid, error) {
func NewCidV1_SHA2_256(data []byte) (cid.Cid, error) {
pref := cid.Prefix{
Version: 1,
Codec: cid.Raw,
Expand Down
5 changes: 2 additions & 3 deletions db/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"github.com/sourcenetwork/defradb/db/base"
"github.com/sourcenetwork/defradb/logging"
"github.com/sourcenetwork/defradb/merkle/crdt"
"github.com/sourcenetwork/defradb/utils"

"errors"

Expand Down Expand Up @@ -160,7 +159,7 @@ func (db *db) CreateCollection(
}

// add a reference to this DB by desc hash
cid, err := utils.NewCidV1(buf)
cid, err := core.NewCidV1_SHA2_256(buf)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -204,7 +203,7 @@ func (db *db) GetCollectionByName(ctx context.Context, name string) (client.Coll
}

// add a reference to this DB by desc hash
cid, err := utils.NewCidV1(buf)
cid, err := core.NewCidV1_SHA2_256(buf)
if err != nil {
return nil, err
}
Expand Down
106 changes: 0 additions & 106 deletions utils/proxystore.go

This file was deleted.

0 comments on commit 222bf6d

Please sign in to comment.