Skip to content

Commit 4709f60

Browse files
committedAug 21, 2018
Rename Inliner to InlineBuilder.
1 parent c614d37 commit 4709f60

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed
 

‎inliner.go ‎inline.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ import (
55
mhash "github.com/multiformats/go-multihash"
66
)
77

8-
// Inliner is a cid.Builder that will use the id multihash when the
8+
// InlineBuilder is a cid.Builder that will use the id multihash when the
99
// size of the content is no more than limit
10-
type Inliner struct {
11-
cid.Builder
12-
Limit int
10+
type InlineBuilder struct {
11+
cid.Builder // Parent Builder
12+
Limit int // Limit (inclusive)
1313
}
1414

1515
// WithCodec implements the cid.Builder interface
16-
func (p Inliner) WithCodec(c uint64) cid.Builder {
17-
return Inliner{p.Builder.WithCodec(c), p.Limit}
16+
func (p InlineBuilder) WithCodec(c uint64) cid.Builder {
17+
return InlineBuilder{p.Builder.WithCodec(c), p.Limit}
1818
}
1919

2020
// Sum implements the cid.Builder interface
21-
func (p Inliner) Sum(data []byte) (*cid.Cid, error) {
21+
func (p InlineBuilder) Sum(data []byte) (*cid.Cid, error) {
2222
if len(data) > p.Limit {
2323
return p.Builder.Sum(data)
2424
}

‎inliner_test.go ‎inline_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import (
88
mhash "github.com/multiformats/go-multihash"
99
)
1010

11-
func TestInlinerSmallValue(t *testing.T) {
12-
builder := Inliner{cid.V0Builder{}, 64}
11+
func TestInlineBuilderSmallValue(t *testing.T) {
12+
builder := InlineBuilder{cid.V0Builder{}, 64}
1313
c, err := builder.Sum([]byte("Hello World"))
1414
if err != nil {
1515
t.Fatal(err)
@@ -19,8 +19,8 @@ func TestInlinerSmallValue(t *testing.T) {
1919
}
2020
}
2121

22-
func TestInlinerLargeValue(t *testing.T) {
23-
builder := Inliner{cid.V0Builder{}, 64}
22+
func TestInlinerBuilderLargeValue(t *testing.T) {
23+
builder := InlineBuilder{cid.V0Builder{}, 64}
2424
data := make([]byte, 512)
2525
rand.Read(data)
2626
c, err := builder.Sum(data)

0 commit comments

Comments
 (0)
Please sign in to comment.