237 Commits

Author SHA1 Message Date
David Dias
ad27ebcfa7
feat: Expose the ProviderManager through the IpfsDht struct (#491)
* feat: Expose the ProviderManager through the IpfsDht struct
* feat: expose providers prefix so that we do not have to hard code it in other places

Co-authored-by: Aarsh Shah <aarshkshah1992@gmail.com>
2020-03-13 09:53:26 -07:00
Adin Schmahmann
5d2e3df37d make all key types loggable 2019-12-19 12:04:25 -05:00
Adin Schmahmann
3e24f352aa provider record keys can be an arbitrary byte array less than 80 bytes instead of only a multihash 2019-12-19 12:00:51 -05:00
Adin Schmahmann
a4b38eebee feat(dht): provider records use multihashes instead of CIDs 2019-12-19 12:00:51 -05:00
Aarsh Shah
ef6ffec073 refresh cpl in dht 2019-12-17 01:25:57 +08:00
Steven Allen
ba86f51884 fix: return a closed channel from FindProvidersAsync when providers are disabled. 2019-12-06 09:27:09 -05:00
Steven Allen
52747fc1f0 feat: allow disabling value and provider storage/messages
fixes #274
2019-12-05 19:11:46 -05:00
Aarsh Shah
5da16344fe refresh bucket only when query is successful 2019-10-11 13:14:07 +09:00
aarshkshah1992
585d6725be refresh a bucket whenever we lookup a key in it 2019-10-11 13:13:53 +09:00
Raúl Kripalani
fed99afe6e
Make routing table bucket size configurable (#396) 2019-10-04 22:12:00 +09:00
Thomas Preindl
8a40bef78c fix deadline calculation in Provide function of routing.go (#377) 2019-07-23 15:19:50 -07:00
Steven Allen
49ccd212f2 feat: make sure to leave time to send provider records 2019-06-29 13:06:08 +02:00
Raúl Kripalani
31765355df
migrate to consolidated types. (#344) 2019-05-26 23:33:15 +01:00
Steven Allen
1cccee0f65 query: fix a goroutine leak when the routing table is empty
When the routing table is empty, `Run` would fail but _not_ close the
process (leaking some query goroutines). This patch fixes this in multiple
places by:

1. Not starting queries with no peers.
2. Failing queries with no peers earlier.
2019-04-26 12:55:45 -07:00
Raúl Kripalani
120a585ebf Revert "Test go mod in travis and use major versioning in import paths (#236)"
This reverts commit 7e68ac3c60c15243c7d2e622b91aed92245a2677.
2019-02-12 14:12:53 +00:00
Adrian Lanzafame
7e68ac3c60 Test go mod in travis and use major versioning in import paths (#236) 2019-02-12 17:38:06 +11:00
Matt Joiner
8b37385468 Rename log to logger 2019-02-03 13:14:35 +11:00
Steven Allen
201eea5e0b
Revert "Tidy up bootstrapping" 2019-01-24 14:06:38 -08:00
Matt Joiner
f423e38edd Simplify the bootstrap logic 2019-01-24 09:52:56 +11:00
Kevin Atkinson
a303c45371 gx update and fix code to use new Cid type 2018-09-11 21:54:47 -04:00
Steven Allen
f5423a6a72 don't double-validate values
Also, de-duplicate some logic.
2018-08-10 13:57:45 -07:00
Steven Allen
cd3cac0194 go fmt 2018-08-10 13:51:01 -07:00
Łukasz Magiera
246579e78b SearchValue: respect ctx on output 2018-08-10 12:13:17 +02:00
Łukasz Magiera
6ca5dd7bf4 SearchValues: more review addressing 2018-08-10 12:06:32 +02:00
Łukasz Magiera
d72432caf1 SearchValue: address review 2018-08-10 12:06:32 +02:00
Łukasz Magiera
51c475d117 SearchValue: make default quorum infinite for search 2018-08-10 12:06:32 +02:00
Łukasz Magiera
307660c78d SearchValue: Make -1 quorum mean infinite on get 2018-08-10 12:06:32 +02:00
Łukasz Magiera
e28b133f80 SearchValue: add backward-compatible GetValues 2018-08-10 12:06:32 +02:00
Łukasz Magiera
547c0a7170 SearchValue: simplify error handling further 2018-08-10 12:06:32 +02:00
Łukasz Magiera
64d1622c72 SearchValue: simplify error handling 2018-08-10 12:06:32 +02:00
Łukasz Magiera
e260fe510f Implement SearchValue 2018-08-10 12:06:32 +02:00
Steven Allen
4d76fd28ed upgrade protobuf and switch to bytes keys
fixes #177
2018-08-07 18:50:04 -07:00
Steven Allen
993399a183 don't treat a canceled context as a successful query
fixes #172
2018-07-10 17:29:02 +02:00
Steven Allen
97131ef4c2 remove random print from test 2018-06-15 14:13:07 -07:00
Steven Allen
ed35a2d66c return ErrNotFound when offline routing is requested and we have no local value
err is nil in this case
2018-06-13 19:20:00 -07:00
Steven Allen
6c4aa35c94 validate and compare record on local put 2018-06-13 17:01:53 -07:00
Steven Allen
39907a7658 reuse getRecordFromDatastore in getValue
Also, double check the key (should be impossible but the check is cheep).
2018-06-13 16:59:12 -07:00
Steven Allen
3befc403d7 require that the validator be explicitly passed in
Note: this does mean that the DHT won't work with peer keys by default and that
the constructor signature changes. Given all the changes that'll come with the
libp2p refactor, I don't feel too bad about this.
2018-05-31 17:54:19 -07:00
Steven Allen
cad57471f5 update for the routing refactor
GetValues was very DHT specific so the routing interface has been updated to
remove that function. Instead, it has introduced general-purpose options.

This is a minimal alternative to #141 to avoid bundling too many changes
together.
2018-05-31 17:47:35 -07:00
vyzo
ae5dd23eb2 mutex protect peersSeen map in FindPeersConnectedToPeer 2018-04-29 21:53:34 +03:00
Steven Allen
058c472825
Merge pull request #134 from MichaelMure/review
document and clean small things
2018-04-01 17:08:02 +00:00
Michael Muré
2026fcb558
document and clean small things 2018-04-01 12:38:15 +02:00
Lars Gierth
db3b915a17 docs: remove mentions of coral, it's not implemented 2018-03-28 03:44:49 +02:00
Dirk McCormick
7808271093 Ensure that records published by this peer do not immediately expire 2018-03-12 13:45:02 -04:00
Dirk McCormick
a9c59f3f15 Remove record signature verification 2018-02-07 14:52:15 -08:00
Forrest Weston
70fc1084b6 Add Event logging to dht routing
License: MIT
Signed-off-by: ForrestWeston <forrest@protocol.ai>
2017-12-11 14:00:16 -08:00
Steven Allen
491afc8e27 optimize allocations
Try to preallocate slices up-front instead of repeatedly reallocating.
2017-12-05 15:46:24 -08:00
Herman Junge
655ea5e262 Add queried peer ID to query event 2017-07-14 22:08:13 -04:00
Jeromy
04ee593ef6 update to use no-broadcast option 2017-05-16 18:23:18 -07:00
Jeromy
52e620c6ef Add addresses from received provider records
Thanks @mildred for catching this and providing a patch.
2017-03-24 10:28:37 -07:00