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
Storage driver for Sia #436
Conversation
…unit tests passing with Sia-Ant-Farm
…unit tests pass once uPnP is configured.
Thank you for your submission! I'll take a look today. |
log.debug("Preparing download from siad @ %s..." % sia_download) | ||
|
||
from os.path import expanduser | ||
destination = expanduser("~") + "/%s" % key |
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.
Should this path be a temporary file path?
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.
I started down the temp file path first but the way that temp files work in Python is that they're created with permissions such that only the files creator can write to it and since the siad daemon could be running as a different user it'd be problematic to do it that way.
with open(destination) as downloaded: | ||
contents = downloaded.read() | ||
|
||
try: |
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.
Would recommend opening the file, unlinking it, reading it, and then closing it. I'd put the open and unlink in a separate try/catch from the read and close. The reason being that once the unlink succeeds, the space will be reclaimed no matter what happens in the driver.
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.
Sure thing. I'll change that when I get home.
Proposed storage driver for Sia in response to #430
It requires a local running instance of Siad or a proper configuration (i.e. client.ini) which is configured to connect to the siad gateway.
The put and get handlers require that the blockstack-client user have disk read/write permissions as Sia at present requires an absolute path for files on upload and download. Taek estimates that this requirement will be changing in the coming weeks.