-
Notifications
You must be signed in to change notification settings - Fork 55
Added support to update repository data #168
Conversation
@ricardodani I think that you can remove the rename handler and merge it into the update handler. So you can use the |
@andrewsmedina I preferred to do it this way because the Thinking thus, For example:
Thinking of giving the things simple, I separated the method in these two. What do you think about this? Would you still recommend using only one route? Thanks |
@ricardodani first of all the My idea is merge update and rename, and only do the "filesystem" stuff when the name will be changed. A way to fix the "rollback" is to make all handler actions as atomic actions for this handler. tsuru has a package to do it. And it is a current problem in the I think that this way will make the api more consistent. |
If we want to rename a repository, we should stop using the name as the id of the document. That remove + insert is ugly. |
It lacks a partial update test, but I believe it works. Apart from the ugliness of the insert+remove, it LGTM. |
5877d1e
to
be61e20
Compare
} | ||
return fs.Filesystem().Rename(barePath(oldName), barePath(newName)) | ||
return nil |
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 think err
should be returned instead, no?
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.
If you notice the erros when they happen, they are aways returned imediatly, in this case i have shure that no errors ocurred, so, return no error
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 understand what you said now. Fixed. But in a different way, returning error explicity on the condition, not on the bottom of the method (which is explict that no errors ocurred)
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.
It won't build with no return at the end, mate 😉
Thanks @scorphus for help in the patch ;)
Added support to update repository data
@ricardodani thank you! |
Its important to notice that
Update
does not renames the repository, cause theRename
method removes the old repository in mongo, inserts the new and renames the filesystem repository. WhileUpdate
just do a simple database update. So its important to maintain this two methods separeted to avoid an intermitent state on database in cases that one of them doesn`t works.