Commit Graph

73 Commits

Author SHA1 Message Date
Juan Batiz-Benet
f952275bf2 shorter queue test (reloaded) 2014-12-10 21:06:07 -08:00
Juan Batiz-Benet
0f12f4b245 shorter peer queue test 2014-12-10 21:03:31 -08:00
Juan Batiz-Benet
26e7656164 dht tests: dont introduce nil multiaddr
this is the type of assumption we shouldn't violate.
2014-12-08 20:52:45 -08:00
Brian Tiger Chow
80bc9251a6 style(peer) shorter ID when printing Peer
feel free to contest/revert if this becomes a problem

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-08 16:28:31 -08:00
Brian Tiger Chow
74eb03231d fix(core, peer) helpers to testutil, err handling
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-08 14:32:52 -08:00
Brian Tiger Chow
c69f6895db feat(peerstore) add peer to peerstore upon instantiation
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-08 02:10:42 -08:00
Brian Tiger Chow
d77c4bb5e0 refactor(peer): create peer through peerstore
for safety!

use mockpeer.WithID methods to create peers in tests

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-08 02:10:42 -08:00
Brian Tiger Chow
73a89e161d refactor(peerstore) s/Get/FindOrCreate
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-08 02:10:42 -08:00
Brian Tiger Chow
1e007791a5 refactor(peer) impl peerstore with map
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-08 02:10:42 -08:00
Brian Tiger Chow
3f63e50c54 fix(peer): use error-checking multiaddr method
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-08 01:10:25 -08:00
Brian Tiger Chow
52631c697e fix(logging) interpret peer id strings correctly
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-11-27 17:29:52 -08:00
Jeromy
0de12b5d36 implement ipfs id in the new commands library 2014-11-16 16:46:06 -08:00
Brian Tiger Chow
4b1607819f log(dht) log a couple events to demonstrate API
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-11-16 07:00:58 -08:00
Brian Tiger Chow
a11c59dcac feat(peer) add Type (Unspecified, Local, Remote) 2014-11-16 07:00:58 -08:00
Brian Tiger Chow
079bdbacdf doc(peer) question 2014-11-16 07:00:28 -08:00
Brian Tiger Chow
2e0371c60a doc(peer) add TODO
TODO ensure correctness at ID generation and enforce this by only exposing functions that generate IDs safely. Then any peer.ID type found in the codebase is known to be correct.
2014-11-16 03:43:23 -08:00
Brian Tiger Chow
0aff6873dd fix(peer) perform bounds check on peer Id when printing String 2014-11-16 03:43:23 -08:00
Brian Tiger Chow
0c530bf5f1 tests(peer) ensure String() works when p created WithId
presently, fails
2014-11-16 03:43:23 -08:00
Brian Tiger Chow
ed4a8eb782 chore(tests) add Short() -> SkipNow() to slowest tests
vanilla:
    21.57 real        45.14 user         8.51 sys

short:
    14.40 real        31.13 user         5.56 sys

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-11-15 02:10:53 -08:00
Jeromy
4f083d54d6 write a few package doc strings to improve look of godoc 2014-11-08 21:42:36 -08:00
Brian Tiger Chow
550b98b7fd doc(peer) 2014-11-05 10:15:17 -08:00
Brian Tiger Chow
074722cf8a fix(peer) update latency 2014-11-05 10:15:17 -08:00
Juan Batiz-Benet
40aea2a934 handshake: log whether new addr observed 2014-11-05 04:05:30 -08:00
Jeromy
c3d04570c0 a few more comments 2014-11-03 03:53:16 +00:00
Juan Batiz-Benet
184c25430b go-vet friendly codebase
- distinguish log.Error and log.Errorf functions
- Initialize structs with field names
- A bit of unreachable code (defers)
2014-10-25 03:46:39 -07:00
Juan Batiz-Benet
701035d5b0 handshake3 (addrs) 2014-10-22 05:25:31 -07:00
Juan Batiz-Benet
f7c1ed39e0 renamed datastore.go -> go-datastore 2014-10-21 15:10:58 -07:00
Juan Batiz-Benet
ac62d13e42 peerstore Put -> Add
Changed lots of peer use, and changed the peerstore to ensure
there is only ever one peer in use.

Fixed #174
2014-10-20 06:37:12 -07:00
Juan Batiz-Benet
9ca87fbb93 peer.Peer is now an interface
![](http://m.memegen.com/77n7dk.jpg)
2014-10-20 03:26:46 -07:00
Juan Batiz-Benet
b1d11ccfcb peerstore constructs peers
Now, all peers should be retrieved from the Peerstore, which will
construct the peers accordingly. This ensures there's only one peer
object per peer (opposite would be bad: things get out sync)

cc @whyrusleeping
2014-10-20 00:44:44 -07:00
Juan Batiz-Benet
08af98d412 logging friendliness 2014-10-18 04:36:20 -07:00
Juan Batiz-Benet
e989d6febe move IDFromPubKey to peer pkg 2014-10-18 04:28:26 -07:00
Jeromy
77cec59083 actually put diagCmd into the super command so it can be run 2014-10-10 13:18:19 -07:00
Juan Batiz-Benet
66839fa1de changed logging, in dht and elsewhere
- use log.* instead of u.*
- use automatic type conversions to .String()
  (Peer.String() prints nicely, and avoids calling b58 encoding
  until needed)
2014-10-07 21:33:59 -07:00
Juan Batiz-Benet
77fccaa2f3 Obviated need for .ID.Pretty() all over the place. 2014-10-06 04:23:55 -07:00
Juan Batiz-Benet
910a76e220 updated multiaddr use across codebase 2014-10-06 04:13:43 -07:00
Juan Batiz-Benet
f3ae0e8e1b u.Hash - error
the u.Hash error can be safely ignored (panic) because multihash
only fails from the selection of hash function. If the fn + length
are valid, it won't error.

cc @whyrusleeping
2014-10-06 02:26:52 -07:00
Juan Batiz-Benet
612be59643 use string datastore keys. 2014-10-03 15:39:22 -07:00
Juan Batiz-Benet
2507680d77 ok fixed queue test 2014-09-26 03:26:48 -07:00
Juan Batiz-Benet
943c3df416 increment time for queue test
it's failing when machine slow (travis)
2014-09-26 02:52:41 -07:00
Juan Batiz-Benet
a93a31f20b peerstore: re-export ErrNotFound
This is to avoid having to import ds elsewhere.
2014-09-26 02:41:46 -07:00
Juan Batiz-Benet
8ed04cfe23 fixed test 2014-09-22 04:06:17 -07:00
Juan Batiz-Benet
569268c676 peer.DecodePrettyID 2014-09-22 04:06:12 -07:00
Juan Batiz-Benet
98c3afeecf clean up channel use 2014-09-22 04:05:22 -07:00
Juan Batiz-Benet
551c40930e chan queue 2014-09-22 04:05:21 -07:00
Juan Batiz-Benet
ae1f7688aa separate to ensure sync safety 2014-09-22 04:05:21 -07:00
Juan Batiz-Benet
9e2c3fb8fc expose Len on PQ 2014-09-22 04:05:21 -07:00
Juan Batiz-Benet
51eeec1a79 sync safety to pq 2014-09-22 04:05:21 -07:00
Juan Batiz-Benet
a21c1b6b62 PeerQueue (based on XOR distance metric) 2014-09-22 04:05:21 -07:00
Juan Batiz-Benet
c4fa995faf Peer: change locking to whole Peer object. 2014-09-22 04:05:19 -07:00