You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As <oc:tags>tag1|tag2|tag3</oc:tags>, not sure if a property can have multiple values. Need to research that.
But first would be good to know if we agree on this or whether we want the sync client + mobile client to do extra OCS calls just to return the favorites tags... I think not.
Also note that the above addition will impact PROPFIND performance a bit, as we'll be fetching tags for all the files in the list, additionally to the properties and other info.
It looks like the WebDAV properties code is a bit messy, might need to be cleant up first if we don't want to duplicate that logic. There seem to be multiple code paths that retrieve the same properties (etag, etc)
PROPFIND is a crucial thing. As we know, we use it a lot in the client's discovery phase, and it is a direct factor of overall performance of the clients. So we have to be very carefully here.
However, I think the approach to return the tags (even if I only can assume what they are) with a PROPFIND result is correct, as long as this is considered:
When a client does PROPFIND, it should send a list of attributes it expects in the result. The desktop clients do that like this for example:
We should be fine if the server code analyzes the attribute list and avoids additional sql commands for attributes which are not required for the answer.
If it is to complicated on a "per attribute" base, we also can identify the attributes of massivly used PROPFINDs and implement specific functions on the server to fetch the sets. That is of course a bit more fragile in case we add/remove attribs.
About the | as separator: I'd say better do not. That opens another nice little door to hell again . Better use the XML defined lists. However, as the tags can be a lot, I'd choose a very short XML element name (maybe t) combined with a proper namespace. Namespacing is a science anyway ;-)
@dragotin thanks a lot for your input!
When I wrote this it was before I found out that extra attrs need to be explicitly requested with PROPFIND. So then I got the same idea you just suggested: add a oc:tags attribute that only appears when explicitly requested, and also avoids extra SELECTs when not requested.
This should be possible already (tried it locally).
I'm still hesitating whether to provide oc:tags alone with the reserved ugly favorite tag _$!<Favorite>!$_ (it was already there, didn't invent it...) or whether to go with both oc:tags and oc:favorite, but with the ugly tag removed from oc:tags.
As for the XML element list, I'm not sure whether WebDAV attrs support that. I didn't find how to make SabreDAV split the value into multiple sub-properties (array didn't work). Maybe there's a way, needs further research.
Also I'd like to try out PROPPATCH for modifying the oc:tag list (and oc:favorite if we go that way), as it seems to already work for custom properties. And that would fit well with the WebDAV protocol. (at least it feels more integrated than providing a separate OCS endpoint)
On a side note: I saw many inconsistencies in our SabreDAV code. Sometimes props are read inside the Node/File/Directory, sometimes in beforeGetProperties (sometimes both / duplicate code). Might need a good tidying up...
Whenever a file is favorited you'll get <oc:favorite>1</oc:favorite>. Not sure whether we had booleans so far ? SabreDAV converts boolean "true" to 1 automatically.
Both properties can be changed with PROPPATCH.
This already works in this PR #12865
But more work is needed for scalability.
Activity
karlitschek commentedon Dec 15, 2014
looks good to me. but i don't know what our client people think. :-)
PVince81 commentedon Dec 15, 2014
For the detail: the way it will work:
If more than 1000 files, it will chunk on 1000 files. See https://github.com/owncloud/core/blob/master/lib/private/tags.php#L217
PVince81 commentedon Dec 15, 2014
It looks like the WebDAV properties code is a bit messy, might need to be cleant up first if we don't want to duplicate that logic. There seem to be multiple code paths that retrieve the same properties (etag, etc)
LukasReschke commentedon Dec 15, 2014
What about using an XML array for that? - Using | as separator looks really odd.
For example:
PVince81 commentedon Dec 15, 2014
I know, I need to find out whether WebDAV properties support that.
PVince81 commentedon Dec 15, 2014
I tried passing an "array" to SabreDAV and it threw an exception, so maybe not possible to use arrays.
Furthermore I just found out that the Webdav properties API is broken: #12862
dragotin commentedon Dec 15, 2014
PROPFIND is a crucial thing. As we know, we use it a lot in the client's discovery phase, and it is a direct factor of overall performance of the clients. So we have to be very carefully here.
However, I think the approach to return the tags (even if I only can assume what they are) with a PROPFIND result is correct, as long as this is considered:
When a client does PROPFIND, it should send a list of attributes it expects in the result. The desktop clients do that like this for example:
We should be fine if the server code analyzes the attribute list and avoids additional sql commands for attributes which are not required for the answer.
If it is to complicated on a "per attribute" base, we also can identify the attributes of massivly used PROPFINDs and implement specific functions on the server to fetch the sets. That is of course a bit more fragile in case we add/remove attribs.
About the
. Better use the XML defined lists. However, as the tags can be a lot, I'd choose a very short XML element name (maybe
|as separator: I'd say better do not. That opens another nice little door to hell againt) combined with a proper namespace. Namespacing is a science anyway ;-)PVince81 commentedon Dec 15, 2014
@dragotin thanks a lot for your input!
When I wrote this it was before I found out that extra attrs need to be explicitly requested with PROPFIND. So then I got the same idea you just suggested: add a
oc:tagsattribute that only appears when explicitly requested, and also avoids extra SELECTs when not requested.This should be possible already (tried it locally).
I'm still hesitating whether to provide
oc:tagsalone with the reserved ugly favorite tag_$!<Favorite>!$_(it was already there, didn't invent it...) or whether to go with bothoc:tagsandoc:favorite, but with the ugly tag removed fromoc:tags.As for the XML element list, I'm not sure whether WebDAV attrs support that. I didn't find how to make SabreDAV split the value into multiple sub-properties (array didn't work). Maybe there's a way, needs further research.
Also I'd like to try out PROPPATCH for modifying the
oc:taglist (andoc:favoriteif we go that way), as it seems to already work for custom properties. And that would fit well with the WebDAV protocol. (at least it feels more integrated than providing a separate OCS endpoint)On a side note: I saw many inconsistencies in our SabreDAV code. Sometimes props are read inside the Node/File/Directory, sometimes in
beforeGetProperties(sometimes both / duplicate code). Might need a good tidying up...PVince81 commentedon Dec 15, 2014
I found how to group tags, had to implement the "DAV\Property" (inspired from HrefList / Href from SabreDAV)
Result is here: #12865
It looks like this:
PVince81 commentedon Dec 16, 2014
Here is an updated PROPFIND where I split oc:tags and oc:favorite:
When the file is tagged with "tag1", "tag2" and is NOT favorited (but the property was requested)
Whenever a file is favorited you'll get
<oc:favorite>1</oc:favorite>. Not sure whether we had booleans so far ? SabreDAV converts boolean "true" to 1 automatically.Both properties can be changed with PROPPATCH.
This already works in this PR #12865
But more work is needed for scalability.