Skip to content
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

Add event system to blockstore #4131

Closed
wants to merge 6 commits into from
Closed

Add event system to blockstore #4131

wants to merge 6 commits into from

Conversation

Kubuxu
Copy link
Member

@Kubuxu Kubuxu commented Aug 8, 2017

This is a small stub of something I hope we shift our blockstore in future.
With additional events like EventGet, EventHas we would be able to:

  1. have add-on functionality in blockstore (imagine Ethereum blockstore plugin)
  2. be much more flexible than what we do now (blockstore wrapping)
  3. it will be easier to expand in future

This stub is to allow me to start working on tri-colour GC for go-ipfs which would replace the stop world GC we currently have.

Later I would also like to swich the current Has caches to base onto the event system.
It is quite possible that in future we will have to implement priority to the events but this can be solved.

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
Kubuxu added 3 commits August 9, 2017 00:45
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
@Kubuxu Kubuxu force-pushed the feat/bs/notif branch 2 times, most recently from 366dcee to 1aecf6f Compare August 9, 2017 20:25
Benchmark results:

BenchmarkEventFireSingle-12      	 1000000	        24.1 ns/op
BenchmarkEventFireMultiple-12    	 1000000	         4.37 ns/op

and zero allocations (to wide to fit).

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
@Kubuxu
Copy link
Member Author

Kubuxu commented Aug 9, 2017

Results of benchmark:

BenchmarkEventFireSingle-12      	 1000000	        24.1 ns/op
BenchmarkEventFireMultiple-12    	 1000000	        4.37 ns/op

and zero allocations (to wide to fit).

@Kubuxu
Copy link
Member Author

Kubuxu commented Aug 9, 2017

The codelimate is dubious, for some reason it is old status but the codecov side is green.

Copy link
Member

@magik6k magik6k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

other than that one small nitpick LGTM

@@ -10,9 +10,10 @@ package filestore
import (
"context"

"gx/ipfs/QmVA4mafxbfH5aEvNz8fyoxC6J1xhAtw88B4GerPznSZBg/go-block-format"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be below

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
@Stebalien
Copy link
Member

So, put/delete events make a lot of sense, IMO. However...

have add-on functionality in blockstore (imagine Ethereum blockstore plugin)

I'm weary of event based systems like this. I used to implement everything this way but ended up deeply regretting it years down the road because it makes it very difficult to determine what happens at any given point in time and what's responsible for what.

Personally, I'd prefer some kind of dispatching, pluggable, multi-level blockservice.

@MichaelMure
Copy link
Contributor

This would also allow later to build an API to give locality update (block added/removed). This is very useful when you build an app on top of IPFS.

@Stebalien
Copy link
Member

(no longer applies)

@Stebalien Stebalien closed this Feb 28, 2019
@hacdias hacdias deleted the feat/bs/notif branch May 9, 2023 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants