56 Commits

Author SHA1 Message Date
David Dias
dffa2f8b27
refactor: ProviderManager (#492)
* test: augment TestProviderManager test, add notes of future tests
* refactor(provider-manager): order funcs, update names for consistency, add code docs
2020-03-13 23:34:30 +00:00
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
Steven Allen
9f0782bdac fix(providers): upgrade warnings to errors
These errors all mean something is going very wrong.
2020-02-18 12:40:49 -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
Steven Allen
0d48254082 chore(dep): update
Update deps:

* Switch to multiformats/go-base32
* Regenerate protobuf decoding code
2019-12-02 13:05:53 -05:00
Raúl Kripalani
31765355df
migrate to consolidated types. (#344) 2019-05-26 23:33:15 +01:00
Steven Allen
e7e9186702 providers: run datastore GC concurrently
Motivation: Walking the datastore can take time and currently blocks
adding/removing providers.

We need to do this in the same goroutine to avoid some logical races.
2019-04-19 14:59:58 -07:00
Steven Allen
5bb50b8d68 providers: test partial GC 2019-04-18 16:31:05 -07:00
Steven Allen
e4d739c96d providers: flush batch on process close 2019-04-18 16:22:35 -07:00
Steven Allen
498dd81699 fix(providers): gc
Otherwise, we'll delete everything.
2019-04-18 16:10:29 -07:00
Steven Allen
b76de45edb providers: improve test coverage 2019-04-13 09:18:28 -07:00
Steven Allen
fbb29ea6b6 providers: optimize GC
1. Don't be n^2.
2. Don't bother walking the cache, just drop it.
2019-04-13 09:18:28 -07:00
Steven Allen
a3b9767038 providers: use the non-locking LRU
We only access it from a single goroutine.
2019-04-13 09:18:28 -07:00
Steven Allen
f4e6d425bd providers: make sure to close provider query, even on error 2019-04-13 09:18:28 -07:00
Steven Allen
3c9d044798 providers: add some documentation 2019-04-13 09:18:28 -07:00
Steven Allen
24c3841189 providers: delete expired provider records on load 2019-04-13 09:18:28 -07:00
Steven Allen
2a3899be0d providers: improve time parsing error checking 2019-04-13 09:18:28 -07:00
Steven Allen
069736916d providers: don't load into the cache on write
This is just extra work as we write through anyways.
2019-04-13 09:18:28 -07:00
Steven Allen
95a6c2509f providers: use raw cids as map keys 2019-04-13 09:18:28 -07:00
Matt Joiner
86d78dc072
golangci-lint run -D errcheck (#298) 2019-03-14 11:07:15 +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
87783c0ed0 better cancel/close after tests 2018-03-14 14:03:11 -07:00
RideWindX
47e3454f42
Set KeysOnly to true of Datastore.Query()
License: MIT
Signed-off-by: Jason Chang <ridewindx@163.com>
2018-03-08 21:29:49 +08:00
Hector Sanjuan
2a04b6ae50 gx publish 3.0.17 2018-02-27 20:27:24 +01:00
Steven Allen
87251f9cb3 explain condition 2017-12-07 13:54:48 -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
Steven Allen
cc9c360ff2 fix: go1.9 monotonic time (for real this time)
* Also, test on go 1.9
2017-09-13 16:58:22 -07:00
Jakub Sztandera
ee1b670ec9
fix: go1.9 monotonic time is not symetric across serialization using == 2017-08-23 14:52:31 +02:00
Kevin Atkinson
ce68333cce Use res.NextSync() instead of res.Next() to avoid using a channel. 2016-11-28 20:38:32 -05:00
Kevin Atkinson
a72dd86fa6 Enhance TestLargeProvidersSet. 2016-11-28 20:38:32 -05:00
Jeromy
6c8be4d4f0 update datastore and go-cid dependencies 2016-11-28 13:22:43 -08:00
Vasily Kolobkov
c12d86580b Test if datastore is checked upon cache miss on adding providers
License: MIT
Signed-off-by: Vasily Kolobkov <polezaivsani@openmailbox.org>
2016-11-16 15:51:40 +02:00
Vasily Kolobkov
f3ebd68803 Check Datastore.Query call for errors
License: MIT
Signed-off-by: Vasily Kolobkov <polezaivsani@openmailbox.org>
2016-11-16 15:49:54 +02:00
Vasily Kolobkov
78f3d979f7 Dispose of ticker on teardown
License: MIT
Signed-off-by: Vasily Kolobkov <polezaivsani@openmailbox.org>
2016-11-16 15:49:54 +02:00
Vasily Kolobkov
bd6e9b1d2f Load providers from datastore on cache miss
Cache miss might mean that provider records where offloaded to
datastore and need to be brough back up in order to have a consistent
cache entry.
2016-11-16 15:49:54 +02:00
Jeromy
b152b1ed87 use NewKey over RawKey as it doesnt exist yet 2016-11-14 18:32:15 -08:00
Jeromy
1b4f407655 add errors and such to log failure messages 2016-11-14 18:31:44 -08:00
Jeromy
2020aa5d10 use old 'Next' method for now 2016-11-14 17:41:36 -08:00
Jeromy
b17e206c81 use an iterator for provider key sweeping 2016-11-14 17:41:05 -08:00
Jeromy
044ea16a66 Use sync iterator and avoid strings.Split 2016-11-14 17:05:34 -08:00
Jeromy
85fe35e758 reduce overhead casting between ds.Keys and strings 2016-11-11 10:13:12 -08:00
Jeromy
6894f33507 update dependencies after package extraction funtime 2016-10-05 12:34:28 -07:00
Jeromy
1af246f18a remove unneeded debug error message 2016-10-04 11:23:27 -07:00
Jeromy
1ac83501a2 fix providers code, cant use cids as lru keys 2016-09-30 10:56:47 -07:00
Jeromy
e00b3ca0a4 use stdlib context and clean up deps 2016-09-30 10:24:03 -07:00
Jeromy
c372d79e42 switch to strings and cids instead of keys 2016-09-30 10:13:57 -07:00
George Antoniadis
30d43d22e0 Fix dependencies 2016-09-02 20:21:23 +01:00
George Antoniadis
5f3e63aa46 Undo gx rewrites and add gx package.json 2016-08-21 17:18:58 +01:00
Jeromy
1bd98f05f4 use batching datastore for providers storage
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-07-26 10:48:25 -07:00