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

Storage driver for Sia #436

Merged
merged 12 commits into from Sep 29, 2018
Merged

Conversation

willmadison
Copy link

@willmadison willmadison commented May 26, 2017

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.

@jcnelson
Copy link
Member

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
Copy link
Member

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?

Copy link
Author

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:
Copy link
Member

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.

Copy link
Author

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.

@kantai kantai closed this Aug 13, 2017
@kantai kantai reopened this Aug 13, 2017
@jcnelson jcnelson merged commit a810033 into stacks-network:rc-0.14.2 Sep 29, 2018
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.

None yet

4 participants