Skip to content

Commit

Permalink
extractify
Browse files Browse the repository at this point in the history
  • Loading branch information
whyrusleeping committed Jul 28, 2018
1 parent 692a352 commit 2770987
Show file tree
Hide file tree
Showing 19 changed files with 177 additions and 55 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2014-2018 Juan Batiz-Benet

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
go-merkledag
==================

[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)
[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)
[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)
[![Coverage Status](https://codecov.io/gh/ipfs/go-merkledag/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-merkledag/branch/master)
[![Travis CI](https://travis-ci.org/ipfs/go-merkledag.svg?branch=master)](https://travis-ci.org/ipfs/go-merkledag)

> go-merkledag implements the 'DAGService' interface and adds two ipld node types, Protobuf and Raw


## Table of Contents

- [TODO](#todo)
- [Contribute](#contribute)
- [License](#license)

## TODO

- Pull out dag-pb stuff into go-ipld-pb
- Pull 'raw nodes' out into go-ipld-raw (maybe main one instead)
- Move most other logic to go-ipld
- Make dagservice constructor take a 'blockstore' to avoid the blockservice offline nonsense
- deprecate this package

## Contribute

PRs are welcome!

Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.

## License

MIT © Juan Batiz-Benet
8 changes: 4 additions & 4 deletions coding.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
"sort"
"strings"

"gx/ipfs/QmVzK524a2VWLqyvtBeiHKsUAWYgeAk4DBeZoY7vpNPNRx/go-block-format"
"github.com/ipfs/go-block-format"

pb "github.com/ipfs/go-ipfs/merkledag/pb"
pb "github.com/ipfs/go-merkledag/pb"

cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid"
ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format"
cid "github.com/ipfs/go-cid"
ipld "github.com/ipfs/go-ipld-format"
)

// for now, we use a PBNode intermediate thing.
Expand Down
4 changes: 2 additions & 2 deletions errservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package merkledag
import (
"context"

cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid"
ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format"
cid "github.com/ipfs/go-cid"
ipld "github.com/ipfs/go-ipld-format"
)

// ErrorService implements ipld.DAGService, returning 'Err' for every call.
Expand Down
11 changes: 5 additions & 6 deletions merkledag.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ import (
"fmt"
"sync"

bserv "github.com/ipfs/go-ipfs/blockservice"

blocks "gx/ipfs/QmVzK524a2VWLqyvtBeiHKsUAWYgeAk4DBeZoY7vpNPNRx/go-block-format"
ipldcbor "gx/ipfs/QmWrbExtUaQQHjJ8FVVDAWj5o1MRAELDUV3VmoQsZHHb6L/go-ipld-cbor"
cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid"
ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format"
blocks "github.com/ipfs/go-block-format"
bserv "github.com/ipfs/go-blockservice"
cid "github.com/ipfs/go-cid"
ipldcbor "github.com/ipfs/go-ipld-cbor"
ipld "github.com/ipfs/go-ipld-format"
)

// TODO: We should move these registrations elsewhere. Really, most of the IPLD
Expand Down
22 changes: 11 additions & 11 deletions merkledag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ import (
"testing"
"time"

bserv "github.com/ipfs/go-ipfs/blockservice"
bstest "github.com/ipfs/go-ipfs/blockservice/test"
. "github.com/ipfs/go-ipfs/merkledag"
mdpb "github.com/ipfs/go-ipfs/merkledag/pb"
dstest "github.com/ipfs/go-ipfs/merkledag/test"

u "gx/ipfs/QmPdKqUcHGFdeSpvjVoaTRPPstGif9GBZb5Q56RVw9o69A/go-ipfs-util"
offline "gx/ipfs/QmS6mo1dPpHdYsVkm27BRZDLxpKBCiJKUH8fHX15XFfMez/go-ipfs-exchange-offline"
blocks "gx/ipfs/QmVzK524a2VWLqyvtBeiHKsUAWYgeAk4DBeZoY7vpNPNRx/go-block-format"
cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid"
ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format"
. "github.com/ipfs/go-merkledag"
mdpb "github.com/ipfs/go-merkledag/pb"
dstest "github.com/ipfs/go-merkledag/test"

blocks "github.com/ipfs/go-block-format"
bserv "github.com/ipfs/go-blockservice"
bstest "github.com/ipfs/go-blockservice/test"
cid "github.com/ipfs/go-cid"
offline "github.com/ipfs/go-ipfs-exchange-offline"
u "github.com/ipfs/go-ipfs-util"
ipld "github.com/ipfs/go-ipld-format"
)

func TestNode(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions node.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"encoding/json"
"fmt"

mh "gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash"
cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid"
ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format"
cid "github.com/ipfs/go-cid"
ipld "github.com/ipfs/go-ipld-format"
mh "github.com/multiformats/go-multihash"
)

// Common errors
Expand Down
6 changes: 3 additions & 3 deletions node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"context"
"testing"

. "github.com/ipfs/go-ipfs/merkledag"
mdtest "github.com/ipfs/go-ipfs/merkledag/test"
. "github.com/ipfs/go-merkledag"
mdtest "github.com/ipfs/go-merkledag/test"

ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format"
ipld "github.com/ipfs/go-ipld-format"
)

func TestRemoveLink(t *testing.T) {
Expand Down
66 changes: 66 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"author": "why",
"bugs": {
"url": "https://github.com/ipfs/go-merkledag"
},
"gx": {
"dvcsimport": "github.com/ipfs/go-merkledag"
},
"gxDependencies": [
{
"author": "stebalien",
"hash": "QmVzK524a2VWLqyvtBeiHKsUAWYgeAk4DBeZoY7vpNPNRx",
"name": "go-block-format",
"version": "0.1.8"
},
{
"author": "whyrusleeping",
"hash": "QmWrbExtUaQQHjJ8FVVDAWj5o1MRAELDUV3VmoQsZHHb6L",
"name": "go-ipld-cbor",
"version": "1.2.14"
},
{
"author": "whyrusleeping",
"hash": "QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP",
"name": "go-cid",
"version": "0.7.22"
},
{
"author": "whyrusleeping",
"hash": "QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ",
"name": "go-ipld-format",
"version": "0.5.5"
},
{
"author": "whyrusleeping",
"hash": "QmPdKqUcHGFdeSpvjVoaTRPPstGif9GBZb5Q56RVw9o69A",
"name": "go-ipfs-util",
"version": "1.2.8"
},
{
"author": "hsanjuan",
"hash": "QmS6mo1dPpHdYsVkm27BRZDLxpKBCiJKUH8fHX15XFfMez",
"name": "go-ipfs-exchange-offline",
"version": "0.0.9"
},
{
"author": "whyrusleeping",
"hash": "QmZ4Qi3GaRbjcx28Sme5eMH7RQjGkt8wHxt2a65oLaeFEV",
"name": "gogo-protobuf",
"version": "0.0.0"
},
{
"author": "why",
"hash": "QmNqRBAhovtf4jVd5cF7YvHaFSsQHHZBaUFwGQWPM2CV7R",
"name": "go-blockservice",
"version": "1.0.1"
}
],
"gxVersion": "0.12.1",
"language": "go",
"license": "",
"name": "go-merkledag",
"releaseCmd": "git commit -a -m \"gx publish $VERSION\"",
"version": "0.0.0"
}

4 changes: 2 additions & 2 deletions pb/merkledag.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pb/merkledagpb_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions raw.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package merkledag

import (
"fmt"
"gx/ipfs/QmVzK524a2VWLqyvtBeiHKsUAWYgeAk4DBeZoY7vpNPNRx/go-block-format"
"github.com/ipfs/go-block-format"

u "gx/ipfs/QmPdKqUcHGFdeSpvjVoaTRPPstGif9GBZb5Q56RVw9o69A/go-ipfs-util"
cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid"
ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format"
cid "github.com/ipfs/go-cid"
u "github.com/ipfs/go-ipfs-util"
ipld "github.com/ipfs/go-ipld-format"
)

// RawNode represents a node which only contains data.
Expand Down
2 changes: 1 addition & 1 deletion readonly.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package merkledag
import (
"fmt"

ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format"
ipld "github.com/ipfs/go-ipld-format"
)

// ErrReadOnly is used when a read-only datastructure is written to.
Expand Down
8 changes: 4 additions & 4 deletions readonly_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"context"
"testing"

. "github.com/ipfs/go-ipfs/merkledag"
dstest "github.com/ipfs/go-ipfs/merkledag/test"
. "github.com/ipfs/go-merkledag"
dstest "github.com/ipfs/go-merkledag/test"

cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid"
ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format"
cid "github.com/ipfs/go-cid"
ipld "github.com/ipfs/go-ipld-format"
)

func TestReadonlyProperties(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions rwservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package merkledag
import (
"context"

cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid"
ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format"
cid "github.com/ipfs/go-cid"
ipld "github.com/ipfs/go-ipld-format"
)

// ComboService implements ipld.DAGService, using 'Read' for all fetch methods,
Expand Down
2 changes: 1 addition & 1 deletion session.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package merkledag
import (
"context"

ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format"
ipld "github.com/ipfs/go-ipld-format"
)

// SessionMaker is an object that can generate a new fetching session.
Expand Down
14 changes: 7 additions & 7 deletions test/utils.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package mdutils

import (
bsrv "github.com/ipfs/go-ipfs/blockservice"
dag "github.com/ipfs/go-ipfs/merkledag"
dag "github.com/ipfs/go-merkledag"

offline "gx/ipfs/QmS6mo1dPpHdYsVkm27BRZDLxpKBCiJKUH8fHX15XFfMez/go-ipfs-exchange-offline"
ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format"
blockstore "gx/ipfs/QmadMhXJLHMFjpRmh85XjpmVDkEtQpNYEZNRpWRvYVLrvb/go-ipfs-blockstore"
ds "gx/ipfs/QmeiCcJfDW1GJnWUArudsv5rQsihpi4oyddPhdqo3CfX6i/go-datastore"
dssync "gx/ipfs/QmeiCcJfDW1GJnWUArudsv5rQsihpi4oyddPhdqo3CfX6i/go-datastore/sync"
bsrv "github.com/ipfs/go-blockservice"
ds "github.com/ipfs/go-datastore"
dssync "github.com/ipfs/go-datastore/sync"
blockstore "github.com/ipfs/go-ipfs-blockstore"
offline "github.com/ipfs/go-ipfs-exchange-offline"
ipld "github.com/ipfs/go-ipld-format"
)

// Mock returns a new thread-safe, mock DAGService.
Expand Down
2 changes: 1 addition & 1 deletion traverse/traverse.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"context"
"errors"

ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format"
ipld "github.com/ipfs/go-ipld-format"
)

// Order is an identifier for traversal algorithm orders
Expand Down
6 changes: 3 additions & 3 deletions traverse/traverse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"fmt"
"testing"

mdag "github.com/ipfs/go-ipfs/merkledag"
mdagtest "github.com/ipfs/go-ipfs/merkledag/test"
mdag "github.com/ipfs/go-merkledag"
mdagtest "github.com/ipfs/go-merkledag/test"

ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format"
ipld "github.com/ipfs/go-ipld-format"
)

func TestDFSPreNoSkip(t *testing.T) {
Expand Down

0 comments on commit 2770987

Please sign in to comment.