Skip to content
This repository was archived by the owner on Jun 26, 2023. It is now read-only.

Commit 8f366a5

Browse files
committed
gx update and fix code to use new Cid type
1 parent 5efd22b commit 8f366a5

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

mfs_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ func setupRoot(ctx context.Context, t *testing.T) (ipld.DAGService, *Root) {
196196
ds := getDagserv(t)
197197

198198
root := emptyDirNode()
199-
rt, err := NewRoot(ctx, ds, root, func(ctx context.Context, c *cid.Cid) error {
199+
rt, err := NewRoot(ctx, ds, root, func(ctx context.Context, c cid.Cid) error {
200200
fmt.Println("PUBLISHED: ", c)
201201
return nil
202202
})

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,33 @@
99
"gxDependencies": [
1010
{
1111
"author": "why",
12-
"hash": "QmNr4E8z9bGTztvHJktp7uQaMdx9p3r9Asrq6eYk7iCh4a",
12+
"hash": "QmURqt1jB9Yu3X4Tr9WQJf36QGN7vi8mGTzjnX2ij1CJwC",
1313
"name": "go-merkledag",
14-
"version": "1.0.14"
14+
"version": "1.1.0"
1515
},
1616
{
1717
"author": "why",
18-
"hash": "QmWAfTyD6KEBm7bzqNRBPvqKrZCDtn5PGbs9V1DKfnVK59",
18+
"hash": "QmPXzQ9LAFGZjcifFANCQFQiYt5SXgJziGoxUfJULVpHyA",
1919
"name": "go-unixfs",
20-
"version": "1.0.16"
20+
"version": "1.1.0"
2121
},
2222
{
2323
"author": "whyrusleeping",
24-
"hash": "QmZFbDTY9jfSBms2MchvYM9oYRbAF19K7Pby47yDBfpPrb",
24+
"hash": "QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7",
2525
"name": "go-cid",
26-
"version": "0.8.0"
26+
"version": "0.9.0"
2727
},
2828
{
2929
"author": "whyrusleeping",
30-
"hash": "QmX5CsuHyVZeTLxgRSYkgLSDQKb9UjE8xnhQzCEJWWWFsC",
30+
"hash": "QmdDXJs4axxefSPgK6Y1QhpJWKuDPnGJiqgq4uncb4rFHL",
3131
"name": "go-ipld-format",
32-
"version": "0.5.8"
32+
"version": "0.6.0"
3333
},
3434
{
3535
"author": "why",
36-
"hash": "QmNgXoHgXU1HzNb2HEZmRww9fDKE9NfDsvQwWLHiKHpvKM",
36+
"hash": "QmRYx6fJzTWFoeTo3qQn64iDrVC154Gy9waQDhvKRr2ND3",
3737
"name": "go-path",
38-
"version": "1.0.14"
38+
"version": "1.1.0"
3939
}
4040
],
4141
"gxVersion": "0.12.1",

repub_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func TestRepublisher(t *testing.T) {
1818

1919
pub := make(chan struct{})
2020

21-
pf := func(ctx context.Context, c *cid.Cid) error {
21+
pf := func(ctx context.Context, c cid.Cid) error {
2222
pub <- struct{}{}
2323
return nil
2424
}
@@ -29,7 +29,7 @@ func TestRepublisher(t *testing.T) {
2929
rp := NewRepublisher(ctx, pf, tshort, tlong)
3030
go rp.Run()
3131

32-
rp.Update(nil)
32+
rp.Update(cid.Undef)
3333

3434
// should hit short timeout
3535
select {
@@ -42,7 +42,7 @@ func TestRepublisher(t *testing.T) {
4242

4343
go func() {
4444
for {
45-
rp.Update(nil)
45+
rp.Update(cid.Undef)
4646
time.Sleep(time.Millisecond * 10)
4747
select {
4848
case <-cctx.Done():

system.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ type Root struct {
5858
}
5959

6060
// PubFunc is the function used by the `publish()` method.
61-
type PubFunc func(context.Context, *cid.Cid) error
61+
type PubFunc func(context.Context, cid.Cid) error
6262

6363
// NewRoot creates a new Root and starts up a republisher routine for it.
6464
func NewRoot(parent context.Context, ds ipld.DAGService, node *dag.ProtoNode, pf PubFunc) (*Root, error) {
@@ -182,8 +182,8 @@ type Republisher struct {
182182
cancel func()
183183

184184
lk sync.Mutex
185-
val *cid.Cid
186-
lastpub *cid.Cid
185+
val cid.Cid
186+
lastpub cid.Cid
187187
}
188188

189189
// NewRepublisher creates a new Republisher object to republish the given root
@@ -201,7 +201,7 @@ func NewRepublisher(ctx context.Context, pf PubFunc, tshort, tlong time.Duration
201201
}
202202
}
203203

204-
func (p *Republisher) setVal(c *cid.Cid) {
204+
func (p *Republisher) setVal(c cid.Cid) {
205205
p.lk.Lock()
206206
defer p.lk.Unlock()
207207
p.val = c
@@ -231,7 +231,7 @@ func (p *Republisher) Close() error {
231231
// Touch signals that an update has occurred since the last publish.
232232
// Multiple consecutive touches may extend the time period before
233233
// the next Publish occurs in order to more efficiently batch updates.
234-
func (np *Republisher) Update(c *cid.Cid) {
234+
func (np *Republisher) Update(c cid.Cid) {
235235
np.setVal(c)
236236
select {
237237
case np.Publish <- struct{}{}:

0 commit comments

Comments
 (0)