Skip to content

Commit

Permalink
gx publish 1.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
whyrusleeping committed Oct 23, 2018
1 parent ce96103 commit 0c4f3fc
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .gx/lastpubver
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.5: QmSjCxuT1s1dV2DakFLs4msc5LYDq3s7VRdFGSE7CtVCJL
1.1.6: Qmc8xd2DkKbjSRsGbw9XXAEeDyadXiDjW9JaqWh8cpVsVZ
6 changes: 3 additions & 3 deletions car.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func init() {
}

type CarHeader struct {
Roots []*cid.Cid
Roots []cid.Cid
Version uint64
}

Expand All @@ -30,7 +30,7 @@ type carWriter struct {
w io.Writer
}

func WriteCar(ctx context.Context, ds format.DAGService, roots []*cid.Cid, w io.Writer) error {
func WriteCar(ctx context.Context, ds format.DAGService, roots []cid.Cid, w io.Writer) error {
cw := &carWriter{ds: ds, w: w}

h := &CarHeader{
Expand Down Expand Up @@ -74,7 +74,7 @@ func (cw *carWriter) WriteHeader(h *CarHeader) error {
return util.LdWrite(cw.w, hb)
}

func (cw *carWriter) enumGetLinks(ctx context.Context, c *cid.Cid) ([]*format.Link, error) {
func (cw *carWriter) enumGetLinks(ctx context.Context, c cid.Cid) ([]*format.Link, error) {
nd, err := cw.ds.Get(ctx, c)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion car_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestRoundtrip(t *testing.T) {
assertAddNodes(t, dserv, a, b, c, nd1, nd2, nd3)

buf := new(bytes.Buffer)
if err := WriteCar(context.Background(), dserv, []*cid.Cid{nd3.Cid()}, buf); err != nil {
if err := WriteCar(context.Background(), dserv, []cid.Cid{nd3.Cid()}, buf); err != nil {
t.Fatal(err)
}

Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,40 @@
"gxDependencies": [
{
"author": "why",
"hash": "QmeLG6jF1xvEmHca5Vy4q4EdQWp8Xq9S6EPyZrN9wvSRLC",
"hash": "QmVvNkTCx8V9Zei8xuTYTBdUXmbnDRS4iNuw1SztYyhQwQ",
"name": "go-merkledag",
"version": "1.0.12"
"version": "1.1.9"
},
{
"author": "whyrusleeping",
"hash": "QmeyKxwBJgB7AP1DgoMAbqHajMnt4C6TuubsKBRVGZVFuH",
"hash": "Qma8k32hzB25pgmdTPQr2DCa2DT2v7yCyGadMiYVKF1pyH",
"name": "go-ipld-cbor",
"version": "1.4.9"
"version": "1.5.2"
},
{
"author": "hsanjuan",
"hash": "QmcmpX42gtDv1fz24kau4wjS9hfwWj5VexWBKgGnWzsyag",
"hash": "QmcDDgAXDbpDUpadCJKLr49KYR4HuL7T8Z1dZTHt6ixsoR",
"name": "go-ipfs-blockstore",
"version": "0.0.18"
"version": "0.1.4"
},
{
"author": "whyrusleeping",
"hash": "QmZFbDTY9jfSBms2MchvYM9oYRbAF19K7Pby47yDBfpPrb",
"hash": "QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7",
"name": "go-cid",
"version": "0.8.0"
"version": "0.9.0"
},
{
"author": "stebalien",
"hash": "QmWAzSEoqZ6xU6pu8yL8e5WaMb7wtbfbhhN4p1DknUPtr3",
"hash": "QmRcHuYzAyswytBuMF78rj3LTChYszomRFXNg4685ZN1WM",
"name": "go-block-format",
"version": "0.1.11"
"version": "0.2.0"
}
],
"gxVersion": "0.12.1",
"language": "go",
"license": "",
"name": "go-car",
"releaseCmd": "git commit -a -m \"gx publish $VERSION\"",
"version": "1.1.5"
"version": "1.1.6"
}

16 changes: 8 additions & 8 deletions util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type BytesReader interface {
}

// TODO: this belongs in the go-cid package
func ReadCid(buf []byte) (*cid.Cid, int, error) {
func ReadCid(buf []byte) (cid.Cid, int, error) {
if bytes.Equal(buf[:2], cidv0Pref) {
c, err := cid.Cast(buf[:34])
return c, 34, err
Expand All @@ -30,37 +30,37 @@ func ReadCid(buf []byte) (*cid.Cid, int, error) {
// assume cidv1
vers, err := binary.ReadUvarint(br)
if err != nil {
return nil, 0, err
return cid.Cid{}, 0, err
}

// TODO: the go-cid package allows version 0 here as well
if vers != 1 {
return nil, 0, fmt.Errorf("invalid cid version number")
return cid.Cid{}, 0, fmt.Errorf("invalid cid version number")
}

codec, err := binary.ReadUvarint(br)
if err != nil {
return nil, 0, err
return cid.Cid{}, 0, err
}

mhr := mh.NewReader(br)
h, err := mhr.ReadMultihash()
if err != nil {
return nil, 0, err
return cid.Cid{}, 0, err
}

return cid.NewCidV1(codec, h), len(buf) - br.Len(), nil
}

func ReadNode(br *bufio.Reader) (*cid.Cid, []byte, error) {
func ReadNode(br *bufio.Reader) (cid.Cid, []byte, error) {
data, err := LdRead(br)
if err != nil {
return nil, nil, err
return cid.Cid{}, nil, err
}

c, n, err := ReadCid(data)
if err != nil {
return nil, nil, err
return cid.Cid{}, nil, err
}

return c, data[n:], nil
Expand Down

0 comments on commit 0c4f3fc

Please sign in to comment.