-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
implement get file stream for writing #33
Conversation
Thanks @garcipat! For the For testing, it is using a storage emulator in the docker-compose.yml file at the root. So if you |
Okay. Should I do another PR in the main repo first then implementing it for the other providers? |
Maybe try implementing ReadWrite as append in azure and make sure that works before we go and change the core Foundatio stream abstraction? |
Sure. As soon as I get back tomorrow. |
Okay I tried too get this to work with a read/write stream but i think Azure (maybe as well others) dont allow read and write at the same time. To explain a little bit what I tried to do any why I'm workin gon that is, that Im having an ZIP archive in file storage. But ZipArchive requires a stream that can read, write and seek. I even tried to write my own stream but It seems that this is not feasable. But wiht local file storage this works fine. I now just dont know how it would be best to have the interface. Only exposing Read and Write is losing the advantage of having both if you are working with FileSystem. But exposing ReadWrite maybe is only supported by a few. Its not a big issue since I'm extending the IFileStorage interface anyway and also the implementations in my code so I can change the behaviour if I like to. But since I was working on it anyway i thought why not to contribute and making that available for others. Tell me what you think would be best. I could also check a few other providers like AWS and see if those can handle it and its maybe only an issue on azure. |
@garcipat Hmm... So I guess in the zip scenario you wouldn't want to just append to a file, you'd actually want to seek and overwrite portions of the file, correct? I've seen a few articles online that seemed to be saying you could seek to different blocks and then overwrite that entire block. One problem is that I think our Azure storage implementation is using an outdated client that we need to get upgraded. Wonder if the newer library would support it? I guess we need to figure out if a majority of blob storage implementations would support that scenario and if so then it would make sense to keep the abstraction as is with a I see this article for S3 indicating that it does not support seekable streams by default, but maybe there are workarounds: I saw a similar one for Azure, but can't seem to find it. Have you found any info? It seems like even an append operation isn't implemented in S3 and probably others since they are S3 compatible. Which makes me feel like we should keep this abstraction simple for now and change to use our own enum that just has read and write stream support and we can always add additional modes in the future since we will be using our own enum. |
No I didn't have time to investigate yet. Then I will create a internal
enum with only read and write that can be expanded if more widly supported
options are available. I will still investigate. Currenly only time is
limited.
Let me make a PR for the main package and then update the others.
|
tests/Foundatio.AzureStorage.Tests/Foundatio.AzureStorage.Tests.csproj
Outdated
Show resolved
Hide resolved
Are the license agreement checks broken? I signed it but it just wont detect it. |
I just logged in and checked configuration and they seem to be configured right, but the site was super slow. I wonder if they are having issues. |
I only had issues on the AzureFoundation one. The other in the base repo worked fine. |
I found out what the issue was. I pushed things with my github account of my project I'm working in. Therefore I had to also sign it with that account. Need to pay attention not to push with that one. |
…Storage # Conflicts: # src/Foundatio.AzureStorage/Foundatio.AzureStorage.csproj # src/Foundatio.AzureStorage/Storage/AzureFileStorage.cs # tests/Directory.Build.props
Hey @ejsmith, I found time to update this PR. For now just the writing was added and should work just fine, also the test for it. The ReadWrite can still be tackled separatly I thought. |
tests/Foundatio.AzureStorage.Tests/Foundatio.AzureStorage.Tests.csproj
Outdated
Show resolved
Hide resolved
Thanks so much for the PR! |
I happy to contribute. I well see if I can also do that with the AWS package if not already done. |
That would be awesome! It doesn't yet support it |
I implemented the new method for getting a stream to write files.
Can you please give feedback regarding the type of exception and also on how to handle the ReadWrite value that works on FileSystem but not for azure since it does only allow either read or write.
Also I dont even know if I can test this locally or only with the actions