Merge pull request #33 from ipfs/20-deps-mgmt
Dependency management: gx all deps + fetch gx from dist.ifps.io Fixes #20.
This commit is contained in:
commit
b388a45e92
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,6 +1,7 @@
|
|||
coverage.out
|
||||
ipfs-cluster-service/ipfs-cluster-service
|
||||
ipfs-cluster-ctl/ipfs-cluster-ctl
|
||||
deptools
|
||||
|
||||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||
*.o
|
||||
|
|
61
Makefile
61
Makefile
|
@ -1,7 +1,21 @@
|
|||
all: server client
|
||||
clean: rwundo
|
||||
gx_version=v0.10.0
|
||||
gx-go_version=v1.4.0
|
||||
|
||||
deptools=deptools
|
||||
|
||||
gx=gx_$(gx_version)
|
||||
gx-go=gx-go_$(gx-go_version)
|
||||
gx_bin=$(deptools)/$(gx)
|
||||
gx-go_bin=$(deptools)/$(gx-go)
|
||||
bin_env=$(shell go env GOHOSTOS)-$(shell go env GOHOSTARCH)
|
||||
|
||||
export PATH := $(deptools):$(PATH)
|
||||
|
||||
all: service ctl
|
||||
clean:
|
||||
$(MAKE) -C ipfs-cluster-service clean
|
||||
$(MAKE) -C ipfs-cluster-ctl clean
|
||||
rm -rf $(deptools)
|
||||
install: deps
|
||||
$(MAKE) -C ipfs-cluster-service install
|
||||
$(MAKE) -C ipfs-cluster-ctl install
|
||||
|
@ -16,22 +30,37 @@ service: deps
|
|||
ctl: deps
|
||||
$(MAKE) -C ipfs-cluster-ctl ipfs-cluster-ctl
|
||||
|
||||
gx:
|
||||
go get github.com/whyrusleeping/gx
|
||||
go get github.com/whyrusleeping/gx-go
|
||||
$(gx_bin):
|
||||
@echo "Downloading gx"
|
||||
@mkdir -p ./$(deptools)
|
||||
@rm -f $(deptools)/gx
|
||||
@wget -nc -q -O $(gx_bin).tgz https://dist.ipfs.io/gx/$(gx_version)/$(gx)_$(bin_env).tar.gz
|
||||
@tar -zxf $(gx_bin).tgz -C $(deptools) --strip-components=1 gx/gx
|
||||
@mv $(deptools)/gx $(gx_bin)
|
||||
@ln -s $(gx) $(deptools)/gx
|
||||
@rm $(gx_bin).tgz
|
||||
|
||||
$(gx-go_bin):
|
||||
@echo "Downloading gx-go"
|
||||
@mkdir -p ./$(deptools)
|
||||
@rm -f $(deptools)gx-go
|
||||
@wget -nc -q -O $(gx-go_bin).tgz https://dist.ipfs.io/gx-go/$(gx-go_version)/$(gx-go)_$(bin_env).tar.gz
|
||||
@tar -zxf $(gx-go_bin).tgz -C $(deptools) --strip-components=1 gx-go/gx-go
|
||||
@mv $(deptools)/gx-go $(gx-go_bin)
|
||||
@ln -s $(gx-go) $(deptools)/gx-go
|
||||
@rm $(gx-go_bin).tgz
|
||||
|
||||
gx: $(gx_bin) $(gx-go_bin)
|
||||
|
||||
deps: gx
|
||||
go get github.com/gorilla/mux
|
||||
go get github.com/hashicorp/raft
|
||||
go get github.com/hashicorp/raft-boltdb
|
||||
go get github.com/ugorji/go/codec
|
||||
gx --verbose install --global
|
||||
gx-go rewrite
|
||||
$(gx_bin) --verbose install --global
|
||||
$(gx-go_bin) rewrite
|
||||
test: deps
|
||||
go test -tags silent -v -covermode count -coverprofile=coverage.out .
|
||||
rw:
|
||||
gx-go rewrite
|
||||
rwundo:
|
||||
gx-go rewrite --undo
|
||||
rw: gx
|
||||
$(gx-go_bin) rewrite
|
||||
rwundo: gx
|
||||
$(gx-go_bin) rewrite --undo
|
||||
publish: rwundo
|
||||
gx publish
|
||||
$(gx_bin) publish
|
||||
.PHONY: all gx deps test rw rwundo publish service ctl install clean
|
||||
|
|
|
@ -44,7 +44,7 @@ Components perform a number of functions and need to be able to communicate with
|
|||
|
||||
Communication between components happens through the RPC API: a set of functions which stablishes which functions are available to components (`rpc_api.go`).
|
||||
|
||||
The RPC API uses `go-libp2p-rpc`. The main Cluster component runs an RPC server. RPC Clients are provided to all components for their use. The main feature of this setup is that **Components can use `go-libp2p-rpc` to perform operations in the local cluster and in any remote cluster node using the same API**.
|
||||
The RPC API uses `go-libp2p-gorpc`. The main Cluster component runs an RPC server. RPC Clients are provided to all components for their use. The main feature of this setup is that **Components can use `go-libp2p-gorpc` to perform operations in the local cluster and in any remote cluster node using the same API**.
|
||||
|
||||
This makes broadcasting operations, contacting the Cluster leader really easy. It also allows to think of a future where components may be completely arbitrary and run from different applications. Local RPC calls, on their side, do not suffer any penalty as the execution is short cut directly to the server component of the Cluster, without network intervention.
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
rpc "github.com/hsanjuan/go-libp2p-rpc"
|
||||
rpc "github.com/hsanjuan/go-libp2p-gorpc"
|
||||
cid "github.com/ipfs/go-cid"
|
||||
crypto "github.com/libp2p/go-libp2p-crypto"
|
||||
host "github.com/libp2p/go-libp2p-host"
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"errors"
|
||||
"testing"
|
||||
|
||||
rpc "github.com/hsanjuan/go-libp2p-rpc"
|
||||
rpc "github.com/hsanjuan/go-libp2p-gorpc"
|
||||
cid "github.com/ipfs/go-cid"
|
||||
)
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
rpc "github.com/hsanjuan/go-libp2p-rpc"
|
||||
rpc "github.com/hsanjuan/go-libp2p-gorpc"
|
||||
cid "github.com/ipfs/go-cid"
|
||||
consensus "github.com/libp2p/go-libp2p-consensus"
|
||||
host "github.com/libp2p/go-libp2p-host"
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
rpc "github.com/hsanjuan/go-libp2p-rpc"
|
||||
rpc "github.com/hsanjuan/go-libp2p-gorpc"
|
||||
cid "github.com/ipfs/go-cid"
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
)
|
||||
|
|
|
@ -11,7 +11,7 @@ package ipfscluster
|
|||
import (
|
||||
"time"
|
||||
|
||||
rpc "github.com/hsanjuan/go-libp2p-rpc"
|
||||
rpc "github.com/hsanjuan/go-libp2p-gorpc"
|
||||
cid "github.com/ipfs/go-cid"
|
||||
logging "github.com/ipfs/go-log"
|
||||
peer "github.com/libp2p/go-libp2p-peer"
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
rpc "github.com/hsanjuan/go-libp2p-rpc"
|
||||
rpc "github.com/hsanjuan/go-libp2p-gorpc"
|
||||
cid "github.com/ipfs/go-cid"
|
||||
peer "github.com/libp2p/go-libp2p-peer"
|
||||
)
|
||||
|
|
32
package.json
32
package.json
|
@ -15,15 +15,15 @@
|
|||
},
|
||||
{
|
||||
"author": "whyrusleeping",
|
||||
"hash": "QmbzCT1CwxVZ2ednptC9RavuJe7Bv8DDi2Ne89qUrA37XM",
|
||||
"hash": "QmdzDdLZ7nj133QvNHypyS9Y39g35bMFk5DJ2pmX7YqtKU",
|
||||
"name": "go-libp2p",
|
||||
"version": "4.3.0"
|
||||
"version": "4.3.5"
|
||||
},
|
||||
{
|
||||
"author": "hsanjuan",
|
||||
"hash": "QmbzVbfqoZ3ovvjCuZ7D7MAnmzNyTsU7cmwyfnZRYBPn69",
|
||||
"hash": "QmURcg2K5geS5fgV5EUKYdyqhsRTwCSzYsFjJpGq91vLCn",
|
||||
"name": "go-libp2p-raft",
|
||||
"version": "1.0.0"
|
||||
"version": "1.0.2"
|
||||
},
|
||||
{
|
||||
"author": "whyrusleeping",
|
||||
|
@ -31,17 +31,29 @@
|
|||
"name": "go-cid",
|
||||
"version": "0.7.7"
|
||||
},
|
||||
{
|
||||
"author": "hector",
|
||||
"hash": "QmZvXudUXTc2G3o2SYPU7uQX1gzbeQkAZXJ6bnN8C4rcXE",
|
||||
"name": "go-libp2p-rpc",
|
||||
"version": "0.0.10"
|
||||
},
|
||||
{
|
||||
"author": "urfave",
|
||||
"hash": "Qmc1AtgBdoUHP8oYSqU81NRYdzohmF45t5XNwVMvhCxsBA",
|
||||
"name": "cli",
|
||||
"version": "1.19.1"
|
||||
},
|
||||
{
|
||||
"author": "hashicorp",
|
||||
"hash": "QmUDCcPkPMPJ149YBpfFLWJtRFeqace5GNdBPD2cW4Z8E6",
|
||||
"name": "raft-boltdb",
|
||||
"version": "2017.1.24"
|
||||
},
|
||||
{
|
||||
"author": "gorilla",
|
||||
"hash": "QmVrBjGjskzhW7HRfC56f4mT3nmNBHj2WWnEXr39G7Y6w8",
|
||||
"name": "mux",
|
||||
"version": "1.3.0"
|
||||
},
|
||||
{
|
||||
"author": "hector",
|
||||
"hash": "QmcmpQc4j164VuyLxxvYM5VZYf8RZRnouttAbvK6ZknUu3",
|
||||
"name": "go-libp2p-gorpc",
|
||||
"version": "0.0.14"
|
||||
}
|
||||
],
|
||||
"gxVersion": "0.10.0",
|
||||
|
|
8
raft.go
8
raft.go
|
@ -4,13 +4,11 @@ import (
|
|||
"io/ioutil"
|
||||
"path/filepath"
|
||||
|
||||
host "github.com/libp2p/go-libp2p-host"
|
||||
libp2praft "github.com/libp2p/go-libp2p-raft"
|
||||
|
||||
peer "github.com/libp2p/go-libp2p-peer"
|
||||
|
||||
hashiraft "github.com/hashicorp/raft"
|
||||
raftboltdb "github.com/hashicorp/raft-boltdb"
|
||||
host "github.com/libp2p/go-libp2p-host"
|
||||
peer "github.com/libp2p/go-libp2p-peer"
|
||||
libp2praft "github.com/libp2p/go-libp2p-raft"
|
||||
)
|
||||
|
||||
// libp2pRaftWrap wraps the stuff that we need to run
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
rpc "github.com/hsanjuan/go-libp2p-rpc"
|
||||
rpc "github.com/hsanjuan/go-libp2p-gorpc"
|
||||
cid "github.com/ipfs/go-cid"
|
||||
peer "github.com/libp2p/go-libp2p-peer"
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
peer "github.com/libp2p/go-libp2p-peer"
|
||||
)
|
||||
|
||||
// RPCAPI is a go-libp2p-rpc service which provides the internal ipfs-cluster
|
||||
// RPCAPI is a go-libp2p-gorpc service which provides the internal ipfs-cluster
|
||||
// API, which enables components and members of the cluster to communicate and
|
||||
// request actions from each other.
|
||||
//
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
rpc "github.com/hsanjuan/go-libp2p-rpc"
|
||||
rpc "github.com/hsanjuan/go-libp2p-gorpc"
|
||||
cid "github.com/ipfs/go-cid"
|
||||
crypto "github.com/libp2p/go-libp2p-crypto"
|
||||
peer "github.com/libp2p/go-libp2p-peer"
|
||||
|
|
Loading…
Reference in New Issue
Block a user