bchavez / RethinkDb.Driver

:headphones: A NoSQL C#/.NET RethinkDB database driver with 100% ReQL API coverage.
http://rethinkdb.com/api/java
Other
384 stars 134 forks source link

Regrid: support client generated IDs for FileInfo #113

Closed oliverjanik closed 7 years ago

oliverjanik commented 7 years ago

Perhaps in UploadOptions which is exposed by Bucket.OpenUploadStream?

bchavez commented 7 years ago

Hi Oliver,

Could you provide a more concrete / use-case example of what you're trying to do?

Thanks, Brian

:dash: :walking: "Bubbles of gas in my brain... Send me off balance, it's not enough"

oliverjanik commented 7 years ago

Sure,

We have an app that provides file upload functionality and it supports that even when you're offline. Then it let's you upload the files when you come back online later.

Now this means we have to identify and generate IDs for files on the client in any case. We use GUIDs for that.

Now if we could get ReGrid to accept an ID that's pre-generated that would save us some complicated transformations. RethinkDB supports this usecase quite well for normal documents.

Think of it as allowing "distributed" File storage and I'm just trying to sync it up to ReGrid ;-)

bchavez commented 7 years ago

Hi Oliver,

Seems legit. I was glossing over the download APIs for ReGrid and looks like we allow the ability to retrieve files by fileId.

So, it does seem natural to allow setting the Id for a FileInfo in the name of API symmetry and overall feel.

In the case of a failed upload / (and retry), I think we'll throw an exception if you try creating a file with the same FileInfo.Id twice. I haven't checked but IIRC some bad things can happen if we tried to allow resuming a failed upload. Hope that seems reasonable to you.

I'll send a PR in a few minutes.

:beach_umbrella: :trumpet: Beach Boys - Good Vibrations (Nick Warren bootleg)

oliverjanik commented 7 years ago

Thanks for the quick response! Error on conflict is reasonable behaviour IMO.

bchavez commented 7 years ago

No problem. :+1:

ReGrid v2.3.19 now available. UploadOptions.ForceFileId should do it. =)

:walking: :sunglasses: "So don't delay... act now supplies are running out..."