-
Notifications
You must be signed in to change notification settings - Fork 24
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
Request for structure review #192
Comments
I like the overall look! The pseudocode uses
I would like to see the relationship between the different types of classes, let's say But for that I guess you should expose more methods of each class right? haha sorry if I'm getting ahead. Also about The rest is all fine with me 😄 |
Thanks for looking over this! the What kind of relationship with the e.g. if you wanted to download the stable release of every game you would; v = vapor.new() -- create the vapor object
while not done do
v:update() -- let vapor manage it's threads, downloads, etc
local done = true
for _,game in pairs(v:getGameCollection():all()) do --- for each game
for _,release in pairs(game:getReleases():all()) do -- for each release
-- if the stable release is not downloaded
if release:getStable():getStatus() == vapor.status.uninitialized then
-- tell vapor you want this data (e.g. start the download)
release:getStable():updateData()
end
-- if the stable release is not ready
if release:getStable():getStatus() ~= vapor.status.ready then
done = false
end
end
end
end Adding download percentage would be really nice, and with the current structure (assuming we can figure out how to get that number via the |
Can I be picky and say you should use a folder for all the classes? |
@Bobbyjoness I think that's a good idea. |
@positive07 added a uninit state: 37fa770 |
Um about the download percentage. We can have a thread compare the current file size to the expected end size and make that a percentage. We can have a dedicated download percentage thread for that. I hope this makes sense. |
@josefnpat When I was talking about releases I was saying just that hahaha, Just got confused with the doc a little, now it's all clear. @Bobbyjoness I dont think that is a good idea, When I worked on something similar I made little request asking for chunks of the code, that way I could monitor how many chunks I had downloaded and how many chunks were missing (you can get the size of a file with a HEAD request) I dont know if this is nice enough, since it requires multiple requests but it worked |
Would that require breaking it up into chunks on the server side or what? I can see that being complicated and taking longer to download. But idk how it would work so idk if it is or isn't complicated but sure seems like it. |
Nope, there is a flag (or header, not sure the name) that allows you to specify the start byte and how many bytes you wanna download... Gonna look it up. Plus it is mainstream HTTP and so it is already supported by LuaSocket. I dont think it would be slower (but it may be, just a little I guess) |
As @positive07 mentioned on IRC, I will consider adding state check's via function calls on anything that extends from download:isUninitialized
download:isReady
download:isDownloading
download:isHashing
download:isProcessing
download:isFail() The only issue I have with that at this moment is that I don't really know all the states that should be available at this moment. |
Other option, having a table called if release:getStable():getStatus() == vapor.status.uninitialized then Just as an idea |
So something like this? if release:getStable():getStatus("ready") then Or worse: if release:getStable():getStatus(vapor.status.ready) then |
Why would that last one be an option? Lol |
First one hahaha though you could get the status from the vapor.status = {
"unititialized";
"downloaded";
...
} |
I'm being a little overzealous with performance here, but I was hoping to avoid strings, since comparing numbers is faster. If you think that using strings to improve API clarity would much outweigh the benefit of indexing them as I am currently doing, tell me. I'd be down to that change. |
Whatever is better for you... It's the same, plus I would use those strings to pass them to the function, say: if dowload.getStatus(vapor.status[1]) then
... |
Both the |
@positive07 How would you feel if we did "both" so to speak and just overload I do want to keep e.g. if download:getStatus(vapor.status.ready) then
print( vapor.util.lang.translate("en",download:getStatus())
end and if download:getStatus("ready") then
print( vapor.util.lang.translate("gr",download:getStatus())
end |
Sounds nice, was thinking about the same thing. so download.getStatus(0) == download.getStatus("uninitialized")
download.getStatus() == "uninitialized" or vapor.status.unititialized |
So, for Vapor1.x, I'm looking for suggestions for the architecture of the library.
Check out this document which describes how the rest of the framework, along with a pseudocode example.
The is entirely OOP, but without a dependent library.
Currently I have the main frame out for everyone to see, and I am open to ideas & suggestions before I start filling out the functions and testing everything. (help would obv. be appreciated when that time comes.)
The text was updated successfully, but these errors were encountered: