-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reprovider strategies #4113
Reprovider strategies #4113
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 I really like this, great work so far :) Definitely want to see some tests of different reprovider strategies at least.
fa8524f
to
92df0d6
Compare
Low patch coverage is likely caused by not collecting coverage stats from iptb tests. For example cc @Kubuxu |
b33fbfb
to
a07e3f9
Compare
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
efb86e7
to
048debe
Compare
core/core.go
Outdated
case "pinned": | ||
keyProvider = rp.NewPinnedProvider(n.Pinning, n.DAG, false) | ||
default: | ||
return fmt.Errorf("unknown reprovider strtaegy '%s'", cfg.Reprovider.Strategy) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo 'strategy'
docs/config.md
Outdated
@@ -15,7 +15,7 @@ a running daemon do not read the config file at runtime. | |||
- [`Identity`](#identity) | |||
- [`Ipns`](#ipns) | |||
- [`Mounts`](#mounts) | |||
- [`ReproviderInterval`](#reproviderinterval) | |||
- [`Reproviderl`](#reprovider) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo?
exchange/reprovide/reprovide.go
Outdated
} | ||
|
||
unmute := rp.muteTrigger() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could I get a comment or two on the muting? I think I get it, but would be great to clearly lay out whats going on
exchange/reprovide/reprovide.go
Outdated
) | ||
|
||
var log = logging.Logger("reprovider") | ||
|
||
type keyChanFunc func(context.Context) (<-chan *cid.Cid, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets export this type, that way you dont have to redefine it inline up above.
exchange/reprovide/providers.go
Outdated
if !onlyRoots { | ||
err := merkledag.EnumerateChildren(ctx, dag.GetLinks, key, set.add) | ||
if err != nil { | ||
return //TODO: propagate to chan / log? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets definitely not ignore this error, at least log.Error it (though propogating it upwards would be optimal)
exchange/reprovide/providers.go
Outdated
} | ||
|
||
type streamingSet struct { | ||
set map[string]struct{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could reuse the cid.Set for this, it has a visit method that does exactly what you want down in 'add'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason this is done like this is to reduce i/o hit on merkledag.EnumerateChildren
that happens when reprovider starts on large repo (with cid.Set I got 100% io use for about 5min with my repo)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, what i'm saying is that instead of having set
here be a map[string]struct{}
, it could instead be a *cid.Set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, fair point, done
ddaddaf
to
5b078b0
Compare
729a3a8
to
fcaf2b9
Compare
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
fcaf2b9
to
4a5b93a
Compare
Reprovider strategies
…r-starts Reprovider strategies
…r-starts Reprovider strategies
Reprovider strategies allow to specify which keys to provide to the content routing.
Supported strategies are:
all
- all blocks,pinned
- all pinned blocks,roots
- root/directly pined blocks.Current reprovider is slow(~0.2keys/s with my setup), so constraining key set should speed the process up, announcing only pin roots should still work quite well in most cases.
TODO: