NebulousLabs / Sia

Blockchain-based marketplace for file storage. Project has moved to GitLab: https://gitlab.com/NebulousLabs/Sia
https://sia.tech
MIT License
2.71k stars 440 forks source link

[WIP] Single download by uid endpoint #3163

Open ChrisSchinnerl opened 6 years ago

ChrisSchinnerl commented 6 years ago

This PR adds a uid to the download struct which can be used to uniquely identify and retrieve a download within the download history. It also adds an endpoint for retrieving a single download by its UID. What I'm not sure about yet is how to provide the user with a UID when a download is initialized. It's easy for async downloads but blocking downloads and streams can't easily return the UID.

We might also want to find a more efficient way to retrieve a specific download info than looping over the whole history every time. Maybe a DownloadHistory wrapper struct with methods like Add, Delete, View etc. would be sufficient that combines a map and slice and keeps them synced.

Resolves #3146