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
refactor(bitswap, blockservice) Give bitswap responsibility for local datastore Gets/Puts #388
Conversation
@whyrusleeping This appears to be a timing issue. The asynchronous nature of the new structure provides has the bitswap waiting on the context a bit more. This isn't a problem at all, but in this test, it makes the functions return in an inconveniently timely manner. TODO don't let the test depend on time. License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
@jbenet @whyrusleeping Let me know if you want to direct the eventlog output to _both_ the file and stderr. Right now it goes to file. Perhaps this is just a minor bip in the larger discussion around log levels. #292 License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
@whyrusleeping License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
@whyrusleeping @jbenet since the logger is created with package scope, don't need to specify the package name in event messages License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
@whyrusleeping License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
Conflicts: exchange/bitswap/bitswap.go
License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
@whyrusleeping i hope this makes it a bit easier to work with tests License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
@whyrusleeping @jbenet License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
@whyrusleeping License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
@whyrusleeping @jbenet Putting the block generator in a util dir until blocks. Can't put it in util/testutil because the util/testutil/dag-generator imports blockservice and blockservice uses the generator. Tough problem. This'll do for now. License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
+ test(notifications) cc @whyrusleeping @jbenet License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
@whyrusleeping @jbenet License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
since this is the blockstore, all writes are blocks and all block writes are expensive. License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
err = s.Remote.HasBlock(ctx, b) | ||
} | ||
return k, err | ||
err := s.Exchange.HasBlock(context.TODO(), b) |
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.
Probably want to pass a context in
I dont know how much I like this PR. Yes, i agree the responsibility split for bitswap is weird, but i dont think the solution should be stripping the BlockService of all responsibility. |
The logical result of this course of action is for Blockservice to become an interface that bitswap implements. This PR demonstrates there isn't a need for the blockservice at all. However, we've discussed moving toward a notification center architecture. Keeping the blockservice around provides some flexibility should we choose to explore that route. With that said, here's an alternative: Perhaps we just want to wrap the blockstore with a layer that detects recent successful writes and elides duplicates. Then, both blockservice and bitswap can have responsibility for writing and we don't have to pay the large IO write penalty. Instead, we would incur a smaller mutex penalty on |
hrm... the idea of making blockservice an interface for bitswap seems fine to me. I guess my gut just says "thats too much responsibility for one object!" |
I share this concern. If (just if) we were to go this route, my take on it is that the
BlockRequests chan<- []Key
Messages chan<- BitSwapMessage
Blocks chan<- Block \4. Then the event loop is basically a frame around the strategy. That said... My honest intuition is that we don't have concrete constraints driving us toward a particular architecture yet. All of this is speculative. Thus, a smaller solution that allows for more flexibility is probably wiser. Caching Blockstore writes is stupid simple and gets the job done. It's just a Blockstore wrapper that modifies |
618a4c7
to
b10543b
Compare
Let's not worry about this change yet. Once |
@whyrusleeping @jbenet
We may want to wait until after #386 is merged. All's the same to me though.