Commit Graph

2935 Commits

Author SHA1 Message Date
Hector Sanjuan
c18b4beea3 Try to go more to the point in the readme. Move quickstart guide to docs/
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-02-27 10:30:09 +01:00
Hector Sanjuan
857e38175e Double-delay on test to allow leader re-election.
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-02-15 15:46:51 +01:00
Hector Sanjuan
37046dc925 go vet fixes
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-02-15 15:46:51 +01:00
Hector Sanjuan
8e45ce64c2 Documentation: captain log, readme and golint fixes
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-02-15 15:46:51 +01:00
Hector Sanjuan
469cf51e62 Make sure all times appear as UTC
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-02-15 14:15:12 +01:00
Hector Sanjuan
56d68dded1 Avoid showing duplicate Addresses in peers IDs.Addresses.
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-02-15 14:15:12 +01:00
Hector Sanjuan
f935eb4245 Use c.id shorthand instead of c.host.ID()
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-02-15 14:15:12 +01:00
Hector Sanjuan
c04df7ecf3 Merge pull request #46 from ipfs/41-replication
Add replication factor support
2017-02-15 13:36:45 +01:00
Hector Sanjuan
3f5c072e2d Small improvements to coverage.sh and travis.yml
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-02-14 19:26:48 +01:00
Hector Sanjuan
2512ecb701 Issue #41: Add Replication factor
New PeerManager, Allocator, Informer components have been added along
with a new "replication_factor" configuration option.

First, cluster peers collect and push metrics (Informer) to the Cluster
leader regularly. The Informer is an interface that can be implemented
in custom wayts to support custom metrics.

Second, on a pin operation, using the information from the collected metrics,
an Allocator can provide a list of preferences as to where the new pin
should be assigned. The Allocator is an interface allowing to provide
different allocation strategies.

Both Allocator and Informer are Cluster Componenets, and have access
to the RPC API.

The allocations are kept in the shared state. Cluster peer failure
detection is still missing and re-allocation is still missing, although
re-pinning something when a node is down/metrics missing does re-allocate
the pin somewhere else.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-02-14 19:13:08 +01:00
Hector Sanjuan
9deb56b762 Improve raft log forwarder
It was very idiotic poll a buffer/read it and then write rather than
just have a custom writer.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-02-09 22:31:04 +01:00
Hector Sanjuan
0e7091c6cb Move testing mocks to subpackage so they can be re-used
Related to #18

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-02-09 17:51:19 +01:00
Hector Sanjuan
c0697599ac Add nice text formatters to the ipfs-cluster-ctl app
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-02-09 16:30:53 +01:00
Hector Sanjuan
1b3d04e18b Move all API-related types to the /api subpackage.
At the beginning we opted for native types which were
serializable (PinInfo had a CidStr field instead of Cid).

Now we provide types in two versions: native and serializable.

Go methods use native. The rest of APIs (REST/RPC) use always
serializable versions. Methods are provided to convert between the
two.

The reason for moving these out of the way is to be able to re-use
type definitions when parsing API responses in `ipfs-cluster-ctl` or
any other clients that come up. API responses are just the serializable
version of types in JSON encoding. This also reduces having
duplicate types defs and parsing methods everywhere.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-02-09 16:30:53 +01:00
Hector Sanjuan
08a0261aae Update Captain's log
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-02-08 20:09:15 +01:00
Hector Sanjuan
33095e6dc6 Merge pull request #40 from ipfs/24-auto-join-bis-bis
Fix #24: Auto-join and auto-leave operations for Cluster
2017-02-08 12:25:41 +01:00
Hector Sanjuan
34fdc329fc Fix #24: Auto-join and auto-leave operations for Cluster
This is the third implementation attempt. This time, rather than
broadcasting PeerAdd/Join requests to the whole cluster, we use the
consensus log to broadcast new peers joining.

This makes it easier to recover from errors and to know who exactly
is member of a cluster and who is not. The consensus is, after all,
meant to agree on things, and the list of cluster peers is something
everyone has to agree on.

Raft itself uses a special log operation to maintain the peer set.

The tests are almost unchanged from the previous attempts so it should
be the same, except it doesn't seem possible to bootstrap a bunch of nodes
at the same time using different bootstrap nodes. It works when using
the same. I'm not sure this worked before either, but the code is
simpler than recursively contacting peers, and scales better for
larger clusters.

Nodes have to be careful about joining clusters while keeping the state
from a different cluster (disjoint logs). This may cause problems with
Raft.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-02-07 18:46:09 +01:00
Hector Sanjuan
4e0407ff5c Add ascii diagram to ipfs-cluster-service help. Add explicit "run" command.
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-02-02 14:34:51 +01:00
Hector Sanjuan
dd29be6dc7 Merge pull request #37 from ipfs/10-cluster-peers
PeerAdd and PeerRemove() functionality
2017-02-02 14:26:07 +01:00
Hector Sanjuan
89ecc1ce89 Encapsulate Raft functions better and simplify the Consensus component
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-02-02 13:51:49 +01:00
Hector Sanjuan
6c18c02106 Issue #10: peers/add and peers/rm feature + tests
This commit adds PeerAdd() and PeerRemove() endpoints, CLI support,
tests. Peer management is a delicate issue because of how the consensus
works underneath and the places that need to track such peers.

When adding a peer the procedure is as follows:

* Try to open a connection to the new peer and abort if not reachable
* Broadcast a PeerManagerAddPeer operation which tells all cluster members
to add the new Peer. The Raft leader will add it to Raft's peerset and
the multiaddress will be saved in the ClusterPeers configuration key.
* If the above fails because some cluster node is not responding,
broadcast a PeerRemove() and try to undo any damage.
* If the broadcast succeeds, send our ClusterPeers to the new Peer along with
the local multiaddress we are using in the connection opened in the
first step (that is the multiaddress through which the other peer can reach us)
* The new peer updates its configuration with the new list and joins
the consensus

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-02-02 13:51:49 +01:00
Hector Sanjuan
77b8830419 Rename captain's log to CAPTAIN.LOG.md
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-27 15:33:45 +01:00
Hector Sanjuan
58a8a9f9ce Update catchline
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-27 13:35:28 +01:00
Hector Sanjuan
43dea68edb Update README, Captain log, fix logging.
Addresses some stuff in #19.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-27 13:30:15 +01:00
Hector Sanjuan
f6de900ddc Merge pull request #36 from ipfs/9-ipfs-proxy-hijack
Fix #9: Add customHandlers for pin/add pin/rm and pin/ls
2017-01-27 12:03:28 +01:00
Hector Sanjuan
592a20511e Fix #9: Add customHandlers for pin/add pin/rm and pin/ls
The proxy now mimics the IPFS daemon for these commands, except
the requests trigger cluster operations.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-27 11:58:49 +01:00
Hector Sanjuan
814b9dc0d5 Merge pull request #35 from ipfs/15-members-info
Fix #15: Peers() provides lots of information now
2017-01-27 11:57:31 +01:00
Hector Sanjuan
4c1e0068f5 Fix #15: Peers() provides lots of information now
I have renamed "members" to "peers".

Added IPFS daemon ID and addresses to the ID object and
have Peers() return the collection of ID() objects from the cluster.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-26 20:24:00 +01:00
Hector Sanjuan
204db61bc6 golint
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-26 13:04:27 +01:00
Hector Sanjuan
f7bf26237b Update deps to latest raft and gorpc
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-26 13:01:35 +01:00
Hector Sanjuan
495ac27c57 Merge pull request #34 from ipfs/8-sync-all
Fixes #8: Reworking PinTracker (sync/recover ops)
2017-01-26 12:52:46 +01:00
Hector Sanjuan
7f9cb0b269 Separate recover() from sync()
This includes adding a new API endpoint, CLI command.

I have also changed some api endpoints. I find:

POST /pins/<cid>/sync
POST /pins/<cid>/recover
GET  /pins/<cid>
GET  /pins

better. The problem is makes the pin list /pinlist but it general
its more consistent.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-25 20:17:19 +01:00
Hector Sanjuan
2566a0cca5 golint and misspellings
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-25 18:10:18 +01:00
Hector Sanjuan
58702d04bc Issue 8: Make SyncAll efficient with a single PinLs call.
This has implied changes to the PinTracker API, to the IPFSConnector API and
a few renames on some PinTracker related constants.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-25 18:07:19 +01:00
Hector Sanjuan
d8d4a0094a Import latest go-libp2p-gorpc
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-25 13:16:40 +01:00
Hector Sanjuan
3b8d643f86 gx publish 0.0.2
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-25 13:10:53 +01:00
Hector Sanjuan
cba87c28a2 Release 0.0.2
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-25 13:10:49 +01:00
Hector Sanjuan
9eb88f892d Improve packages.json and add release script
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-25 13:09:36 +01:00
Hector Sanjuan
b388a45e92 Merge pull request #33 from ipfs/20-deps-mgmt
Dependency management: gx all deps + fetch gx from dist.ifps.io

Fixes #20.
2017-01-25 12:56:09 +01:00
Hector Sanjuan
78aa03e2d8 A raft-boltdb import was permanently gx'ed
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-25 12:50:46 +01:00
Hector Sanjuan
9a47e6dd1f Update go-libp2p-gorpc
Uses experimental version of multicodecs but should finally pin all deps

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-25 12:50:46 +01:00
Hector Sanjuan
cd307b08ad Try to fix gx-go not rewriting correctly
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-25 12:50:05 +01:00
Hector Sanjuan
85092ede9a Update libs. Make sure libp2p versions match
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-25 12:50:05 +01:00
Hector Sanjuan
8719d88e13 gx all dependencies
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-25 12:50:05 +01:00
Hector Sanjuan
154d4dab74 Issue #20: Download a local installation of gx
This way we do not mess with the users stuff

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-25 12:48:16 +01:00
Hector Sanjuan
4cc3c1125b Merge pull request #32 from ipfs/21-cli-tooling
Fixes #21. 

Rewrite the tools with urfave/cli. 

Add Cluster.ID()
2017-01-25 12:44:03 +01:00
Hector Sanjuan
3f833a8c17 Use urfave/cli for ipfs-cluster-service too.
Added consistency to tools, plus it's worth the effot at this point.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-24 19:55:06 +01:00
Hector Sanjuan
8883ab3a74 Import cli in 1.19.1 tag
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-24 17:29:49 +01:00
Hector Sanjuan
1175f971fe Update cli import with the right author
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-24 17:23:07 +01:00
Hector Sanjuan
81db084249 Make sure the commit string gets set. Fix PublicKey. Output JSON in cluster-ctl
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-24 16:56:14 +01:00