chavoosh / ndn-mongo-fileserver

An NDN fileserver based on MongoDB
GNU General Public License v3.0
5 stars 2 forks source link

delete after modify the name of file? #13

Open wenkaizheng opened 4 years ago

wenkaizheng commented 4 years ago

If the user just change the name of file, can i just delete the previous and download the new one even they are the same video?

wenkaizheng commented 4 years ago

or do i just keep the old file and do not download the new one?

wenkaizheng commented 4 years ago

Also what is other use case for updating video except change the name of file?

chavoosh commented 4 years ago

or do i just keep the old file and do not download the new one?

The best way would be merely renaming the Data chunks in the DB. So, if the user changed the name of a video file which is already inserted to the DB, you can iterate its Data chunks and update their names, accordingly. This way we will not go through the heavy-loaded encoding process again.

Also what is other use case for updating video except change the name of file?

At the moment, we can assume that is the only modification that end-users are allowed to do.

wenkaizheng commented 4 years ago

How to access the Data chunks in DB? when i run ./driver.sh video.mp4, the drivers script chunk the video.mp4 to many different files, for example a.mp4,b, b.mp4, and c.mp4. How should i deal with those files?

chavoosh commented 4 years ago

The data chunks of a given video file fall under the same name prefix, say the name of the video is test_video and the name prefix of our service is /ndn/web/video, then all Data chunks of that video will have a prefix like: /ndn/web/video/test_video/....

What you need to do is finding all such Data chunks in the DB (by using a regex, probably) and rename them. Say the new name of the video is /test_video_modified then all the Data chunks should have the following name pattern: /ndn/web/video/test_video_modified/....

wenkaizheng commented 4 years ago

Find all such Data chunks in DB. do you mean query in DB? I think i am confused about what does DB look like and how to play with it.

chavoosh commented 4 years ago

Find all such Data chunks in DB. do you mean query in DB?

Yes

I think i am confused about what does DB look like and how to play with it.

Look at this: https://github.com/chavoosh/ndn-mongo-fileserver/tree/master/src/util