-
Notifications
You must be signed in to change notification settings - Fork 3
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
Use gitlab_git #9
Comments
It looks like |
I "reviewed" the code of gitlab_git and found that it supports everything we need except for two features:
While the first missing feature can be easily implemented using the git commandline client (which is a dependency anyway), the second one should be implemented with a decorator of gitlab_git. It can be wrapped around the There is the problem of maintenance, though: I pulled the changes from gitlab-ce into a fork of gitlab_git and adjusted them to the gem. There were a few lines in the code that depended on gitlab-ce, but they could easily be rewritten such that gitlab_git is self-contained (see the branch update_to_gitlab_edb8ed36 on https://github.com/ontohub/gitlab_git). It took me about an hour to adjust the code. It might get more difficult in the future with a tighter integration of gitlab_git into gitlab-ce, but I think it's still easier to pull in the changes on every gitlab-ce release than to maintain an own git library. |
The routes for this shall look similar to
|
We might want to start thinking about how we want to transfer files from the client to the server. We have three options:
IMO they are all not ideal, but a combination of 2 and 3 could work with a field that indicates if we're transferring a binary file that needs to be decoded on the server, or if the content is plain text. That way we only have the increased file size for binary files. |
I agree with you. I think a multipart file upload should be avoided in order to stay consistent in the API. Encoding plain text, which is our primary resource type, would be too much. However, we need to encode binary files into plain text, so a hybrid approach seems to be the best. |
So, as it turns out, it's not as easy as I hoped. Distinguishing binary data from utf-8 encoded strings is pretty much impossible (unless a BOM has been set, which is not needed). Also it would not actually help anything, since the characters that need to be escaped for JSON are normal ASCII characters and control sequences. So our options are actually:
For now I'am actually favouring the base64 option (it's good enough for now), but implementing it in a way that we can later replace the encoding easily. For example, we could let the client send a field |
I agree. The factor of 1.3 is not a big problem. |
Relevant for server-to-client communication: http://davidbcalhoun.com/2011/when-to-base64-encode-images-and-when-not-to/ We probably don't want to compress the JSON payload on the client side before sending it to the server, but the other direction should be gzipped to reduce the base64 overhead (when the client accepts it and the payload is bigger than |
Two alternative thoughts on this:
I think, gzipping some content depending on factors like file size is not a good idea at this point in the development of Ontohub. We should postpone this to when the application is usable because it's more of an optimisation problem. |
Use gitlab_git to
This shall be done in service objects that use the models File and Commit (ontohub/ontohub-models#13).
The text was updated successfully, but these errors were encountered: