Commit Graph

198 Commits

Author SHA1 Message Date
Wyatt Daviau
11e8e9d62c Addressing second round of comments
License: MIT
Signed-off-by: Wyatt Daviau <wdaviau@cs.stanford.edu>
2018-08-07 20:11:23 +02:00
Wyatt Daviau
ceba32f871 Test for ipfscon:blockPut
License: MIT
Signed-off-by: Wyatt Daviau <wdaviau@cs.stanford.edu>
2018-08-07 20:11:23 +02:00
Wyatt Daviau
40f8eeedb5 cluster-ctl add to ipfs
RPC call to put a block in ipfs
IPFSConnector method to implement the RPC call
cluster restapi reads from channel and puts
blocks into IPFS via RPC in ctl add handler

License: MIT
Signed-off-by: Wyatt Daviau <wdaviau@cs.stanford.edu>
2018-08-07 20:11:23 +02:00
Hector Sanjuan
78a25e38f8 Fix #462: Support DNS multiaddresses for node_multiaddress
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-06-12 10:09:03 +02:00
Hector Sanjuan
6d9ddfaf85
Merge pull request #427 from ipfs/fix/pin-context-timeout
ipfshttp: Use custom http clients for pin/unpin
2018-05-25 09:44:53 +02:00
Adrian Lanzafame
80e7baca91
ipfshttp: hande request timeouts to ifps daemon correctly
License: MIT
Signed-off-by: Adrian Lanzafame <adrianlanzafame92@gmail.com>
2018-05-24 17:13:56 +10:00
Hector Sanjuan
5563297d40 Set refs as default pinning method, with 10 parallel pins
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-14 17:00:33 +02:00
Hector Sanjuan
aa1f74e69b Fix: some govet warnings
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-11 19:59:10 +02:00
Hector Sanjuan
9856bcdb94 Pintracker: remove timeouts
Pinning/unpinning timeouts are controlled by the ipfs connector component.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-02 15:24:26 +02:00
Adrian Lanzafame
f68c7f5354 ipfshttp: add pin/unpin specific timeouts
and get the tests passing and add Pin/UnpinQueued
tracker statuses back in.

License: MIT
Signed-off-by: Adrian Lanzafame <adrianlanzafame92@gmail.com>
2018-05-02 15:24:26 +02:00
Adrian Lanzafame
9e20e4e3b2 ipfsconn/ipfshttp: Pass ctx through from rpc_api
to the ipfscluster.IPFSConnector interface and then
to the implementation of that interface in ipfsconn/ipfshttp.
This allows calls from MapPinTracker to cancel requests made
to the local IPFS node.

License: MIT
Signed-off-by: Adrian Lanzafame <adrianlanzafame92@gmail.com>
2018-05-02 15:24:26 +02:00
Adrian Lanzafame
a2f59b26af ipfshttp/config: add ClientPostTimeout value
ipfshttp: cancel POST request when timeout reached

ipfshttp/config: fix config test

ipfshttp: use struct styling for multi-line func calls

ipfshttp/config: add general ClientTimeout

License: MIT
Signed-off-by: Adrian Lanzafame <adrianlanzafame92@gmail.com>
2018-05-02 15:24:26 +02:00
Adrian Lanzafame
b50a05f898
ipfsconn/ipfshttp: go1.9 ServeMux doesn't redirect
query args correctly, requiring both a trailing slash and
non-trailing slash handle pattern to be defined for the
pin and unpin handlers.

License: MIT
Signed-off-by: Adrian Lanzafame <adrianlanzafame92@gmail.com>
2018-04-30 15:21:03 +10:00
Adrian Lanzafame
22ec210c25
ipfsconn/ipfshttp: handle cid args passed in url path correctly
The extractCid function was added to enable the extraction of
a cid argument from either the url path or query string.
This puts the proxy behaviour on par with the current IPFS API.
The function does rely on the fact that ipfs-cluster doesn't
intercept any command that has more than one subcommand.
If that changes, this function will have to be updated.

License: MIT
Signed-off-by: Adrian Lanzafame <adrianlanzafame92@gmail.com>
2018-04-30 15:21:03 +10:00
Hector Sanjuan
a9a58a50a0 Config: provide utility to parse duration arguments. Use it.
Should reduce complexity (codeclimate).

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-03-16 14:22:11 +01:00
Wyatt Daviau
1b7b9185e2 support for recursive pins
extension to api types
modifications to ipfsconnector

License: MIT
Signed-off-by: Wyatt Daviau <wdaviau@cs.stanford.edu>
2018-03-12 11:06:42 -04:00
Hector Sanjuan
e8f9fe5566 ipfshttp: Re-use pinning test for both methods
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-03-09 15:01:29 +01:00
Hector Sanjuan
6a858efbcc ipfshttp: refactor post(). Fix race condition. Support custom http.Client.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-03-09 15:01:29 +01:00
Hector Sanjuan
fb4812ec79 Feat #326: Adds "refs -r" pinning method support + multiple pin workers
This fixes #326. It adds a new `pin_method` configuration option to the
`ipfshttp` component allows to configure it to perform `refs -r <cid>` before
the `pin/add` call. By fetching content before pinning, we don't have
a global lock in place, and we can have several pin-requests to
ipfs in parallel.

It also adds a `concurrent_pins` option to the pin tracker, which
launches more pin workers so it can potentially trigger more pins at
the same time. This is a minimal intervention in the pintracker as #308
is still pending.

Documentation for the configuration file has been updated.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-03-09 15:01:29 +01:00
Hector Sanjuan
a180f1a5c5
Merge pull request #291 from ipfs/feat/connectivity-graph
Feat/connectivity graph
2018-01-26 12:42:18 +01:00
Hector Sanjuan
67e505964e Tests: make ipfshttp connector tests bind on random port
For jenkins

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-01-24 20:17:42 +01:00
Hector Sanjuan
ddb5da18c9 Tests: Bind testing clusters on random port
Jenkins likes this very much.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-01-24 20:16:55 +01:00
ZenGround0
4b26ccd144
Merge branch 'master' into feat/connectivity-graph 2018-01-23 08:34:43 -05:00
Wyatt Daviau
d2ef32f48f Testing and polishing connection graph
Added go tests
Refactored cluster connect graph to new file
Refactored dot file printing to new repo
Fixed code climate issues
Added sharness test

License: MIT
Signed-off-by: Wyatt Daviau <wdaviau@cs.stanford.edu>
2018-01-22 10:03:37 -05:00
Wyatt
e712c87570 First draft of ConnectGraph collection:
added ConnectGraph type and serialization
added cli command hitting cluster api
added cluster api client method + endpoint calling into rpc
added rpc calling into main cluster component
added clustercomponent's function to collect ConnectGraph
added functionality in ipfsconn to retrieve ipfs swarm peers
added dot file printing given ConnectGraphSerial

License: MIT
Signed-off-by: Wyatt Daviau <wdaviau@cs.stanford.edu>
2018-01-22 09:07:12 -05:00
Wyatt Daviau
a99b403273 Sharness hardening:
Better error messages in test-lib init functions and ipfshttp
Cleanup functions are now called after every test file

License: MIT
Signed-off-by: Wyatt Daviau <wdaviau@cs.stanford.edu>
2018-01-09 14:17:21 -05:00
Hector Sanjuan
0693ff429e fix spelling: Fix spelling errors
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-12-06 15:15:54 +01:00
Hector Sanjuan
7cd2d3d0e1 fix inef assignments: fix some unused assignments
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-12-06 15:15:52 +01:00
Hector Sanjuan
a656e45375 cluster: safeguard consensus not set when calling ID
SwarmConnect on the ipfs connector calls rpc Peers() which
requests IDs for every peer member. If that peer member
is booting, it might get the request after RPC is setup
but before consensus is initialized. In which case
a panic happens. Probability that this happens is small, but still.

Also increase the connect swarms delay to 30 seconds, which
should be a bit longer than the default wait_for_leader timeout,
otherwise we might connect swarms while there's not even a leader.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-11-15 16:38:21 +01:00
Hector Sanjuan
f14f2f4863 Fix #224: Better handling of progress updates when proxy-adding file
Up to now, we hardcoded progress to "false" in the proxy, regardless
of what the original request said. We now leave it as it is, and
just ignore any progress updates when processing the response.

Since the response is buffered and sent back all together, they are
still useless, but at least the clients (ipfs cli) won't show a 0%
progress bar when successfully adding a file.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-11-13 14:09:20 +01:00
Hector Sanjuan
00e871ddec Fix #202: Fix informers and allocators for 32-bit architectures 2017-10-26 16:01:41 +02:00
Hector Sanjuan
fb8fdb94c5 Issue #162: Improve Config.ToJSON() tests
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-10-20 10:42:41 +02:00
Hector Sanjuan
3cf4d90536 Issue #162: Add ipfshttp.Config tests
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-10-19 21:02:38 +02:00
Hector Sanjuan
8f06baa1bf Issue #162: Rework configuration format
The following commit reimplements ipfs-cluster configuration under
the following premises:

  * Each component is initialized with a configuration object
  defined by its module
  * Each component decides how the JSON representation of its
  configuration looks like
  * Each component parses and validates its own configuration
  * Each component exposes its own defaults
  * Component configurations are make the sections of a
  central JSON configuration file (which replaces the current
  JSON format)
  * Component configurations implement a common interface
  (config.ComponentConfig) with a set of common operations
  * The central configuration file is managed by a
  config.ConfigManager which:
    * Registers ComponentConfigs
    * Assigns the correspondent sections from the JSON file to each
    component and delegates the parsing
    * Delegates the JSON generation for each section
    * Can be notified when the configuration is updated and must be
    saved to disk

The new service.json would then look as follows:

```json
{
  "cluster": {
    "id": "QmTVW8NoRxC5wBhV7WtAYtRn7itipEESfozWN5KmXUQnk2",
    "private_key": "<...>",
    "secret": "00224102ae6aaf94f2606abf69a0e278251ecc1d64815b617ff19d6d2841f786",
    "peers": [],
    "bootstrap": [],
    "leave_on_shutdown": false,
    "listen_multiaddress": "/ip4/0.0.0.0/tcp/9096",
    "state_sync_interval": "1m0s",
    "ipfs_sync_interval": "2m10s",
    "replication_factor": -1,
    "monitor_ping_interval": "15s"
  },
  "consensus": {
    "raft": {
      "heartbeat_timeout": "1s",
      "election_timeout": "1s",
      "commit_timeout": "50ms",
      "max_append_entries": 64,
      "trailing_logs": 10240,
      "snapshot_interval": "2m0s",
      "snapshot_threshold": 8192,
      "leader_lease_timeout": "500ms"
    }
  },
  "api": {
    "restapi": {
      "listen_multiaddress": "/ip4/127.0.0.1/tcp/9094",
      "read_timeout": "30s",
      "read_header_timeout": "5s",
      "write_timeout": "1m0s",
      "idle_timeout": "2m0s"
    }
  },
  "ipfs_connector": {
    "ipfshttp": {
      "proxy_listen_multiaddress": "/ip4/127.0.0.1/tcp/9095",
      "node_multiaddress": "/ip4/127.0.0.1/tcp/5001",
      "connect_swarms_delay": "7s",
      "proxy_read_timeout": "10m0s",
      "proxy_read_header_timeout": "5s",
      "proxy_write_timeout": "10m0s",
      "proxy_idle_timeout": "1m0s"
    }
  },
  "monitor": {
    "monbasic": {
      "check_interval": "15s"
    }
  },
  "informer": {
    "disk": {
      "metric_ttl": "30s",
      "metric_type": "freespace"
    },
    "numpin": {
      "metric_ttl": "10s"
    }
  }
}
```

This new format aims to be easily extensible per component. As such,
it already surfaces quite a few new options which were hardcoded
before.

Additionally, since Go API have changed, some redundant methods have been
removed and small refactoring has happened to take advantage of the new
way.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-10-18 00:00:12 +02:00
Wyatt
598aaf2623 Undoing gx rewrites 2017-10-13 12:44:43 -04:00
Wyatt
c178afe371 Replace get requests with posts 2017-10-13 12:38:18 -04:00
dgrisham
a46ab3dda9 freespace metric partial impl 2017-08-03 11:24:19 -06:00
Hector Sanjuan
bb82c27b25 Fix #87: Implement ipfs-cluster-ctl pin ls <cid>
I have updated API endpoints to be /allocations rather than /pinlinst

It's more self-explanatory.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-04-06 21:12:16 +02:00
Hector Sanjuan
9b3449e3f8 Remove debugging leftovers in ipfshttp
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-30 15:38:41 +02:00
Hector Sanjuan
18034356fa Fix #57: Hijack /add requests and pin items in cluster after ipfs adds them.
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-30 11:27:40 +02:00
Hector Sanjuan
30262a2499 Fix ipfs proxy not respecting return status codes
Added extra test for it.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-28 11:09:05 +02:00
Hector Sanjuan
2bbbea79cc Issue #49: Add disk informer
The disk informer uses "ipfs repo stat" to fetch the RepoSize value and
uses it as a metric.

The numpinalloc allocator is now a generalized ascendalloc which
sorts metrics in ascending order and return the ones with lowest
values.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-27 20:40:49 +02:00
Hector Sanjuan
4bb30cd24a Fixes #16: trigger ipfs swarm connect to other ipfs nodes in the cluster.
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-27 12:42:54 +02:00
Hector Sanjuan
17796afb2e Use "pin ls --type=recursive $pin" when checking if a pin exists
This is significantly faster for pins that don't exist.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-21 12:57:09 +01:00
Hector Sanjuan
f3c1636062 Take advantage of go-multiaddr-net utilities.
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-16 15:51:24 +01:00
Hector Sanjuan
03a931b8df Fix logging
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-14 17:32:00 +01:00
Hector Sanjuan
e2efef8469 go lint, go vet, put the Consensus component behind interface.
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-14 16:37:29 +01:00
Hector Sanjuan
37fab27ba6 Move MapPinTracker to its own submodule and add tests for it
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-14 16:10:45 +01:00