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

Encoder Progress / Source Progress #3

Closed
alvises opened this issue Nov 29, 2019 · 7 comments
Closed

Encoder Progress / Source Progress #3

alvises opened this issue Nov 29, 2019 · 7 comments
Assignees

Comments

@alvises
Copy link

alvises commented Nov 29, 2019

It would be nice to have a way to know the progress of compression and, in case of :url entries download progress as well.

The two options I have in mind are:

  • be notified asynchronously via message, so we pass a pid to Packmatic.build_stream/2 in the options.
  • or synchronously, passing a callback.
@evadne evadne self-assigned this Nov 30, 2019
@evadne evadne changed the title Compression progress and in case of url entry download progress as well Encoder Progress / Source Progress Nov 30, 2019
@evadne
Copy link
Owner

evadne commented Nov 30, 2019

For progress of the Encoder, reporting can be had by integrating with gen_event, although some custom structs will be defined to represent the possible range of events. For progress of each Source, that may have to be done as an opt-in thing as support for custom sources has now been implemented and will come up soon. Further thinking required.

@evadne
Copy link
Owner

evadne commented Dec 1, 2019

I have kind of sorted this out for the Encoder but need more design for Sources to participate.

@evadne
Copy link
Owner

evadne commented Dec 1, 2019

@alvises Please take a look at #5 esp. test/packmatic/event_test.exs and let me know if that is more or less aligned with what we want to do here.

As to Source progress, since not all Sources know how many bytes they need to read (sometimes you don’t have this information, for example if you are reading from a connection that is serving a Packmatic stream 😛), I am thinking of something optional. For example, the signature of c:Packmatic.Source.init/1 and/or c:Packmatic.Source.read/1 could be extended to allow some sort of metadata (e.g. estimated bytes total/remaining) to be returned.

@alvises
Copy link
Author

alvises commented Dec 14, 2019

handler_fun = fn event ->
  :ok = Process.send(parent, event, [:noconnect, :nosuspend])
end

Packmatic.build_stream(on_error: :skip, on_event: handler_fun)

Really nice! Exactly what I meant :)

@evadne
Copy link
Owner

evadne commented Feb 14, 2020

@alvises 👋

This is good news, I shall merge this soon.

@alvises
Copy link
Author

alvises commented Feb 14, 2020

@alvises 👋

This is good news, I shall merge this soon.

That's great!!

@evadne
Copy link
Owner

evadne commented Oct 3, 2020

This is merged into develop and a new release on Hex will be coming tomorrow.

@evadne evadne closed this as completed Oct 3, 2020
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

No branches or pull requests

2 participants