Development of WebDAV quotas

Development of WebDAV quotas


Thomas Bellembois   (University of Rennes 1) 

Dates de modification
Revision 1.0 13-07-2005 Thomas Bellembois (University of Rennes 1)
Revision 1.1 23-06-2005 Thomas Bellembois (University of Rennes 1) - adding the Web service specifications
Revision 1.2 13 07 2005 Thomas Bellembois (University of Rennes 1) - modifying the Web service specifications
1. Introduction
2. Notational conventions
3. Solution overview
3.1. Metadata
3.2. Compliance with the WebDAV quota RFC
3.3. Coherence
3.4. Quota processing
3.4.1. Firstly without the notion of virtual root (autonomous collection)…
3.4.2. Now the virtual root…
4. Configuration – administration
4.1. Requirements
4.2. Solution 1
4.2.1. Configuration file
4.2.2. <path>
4.2.3. <init-used>
4.2.4. Thread
4.3. Solution 2
4.3.1. Web service
4.3.2. Functions
5. Notes

1. Introduction

Within the context of a CMS development, we had to develop a Slide-based WebDav server to manage quotas. The purpose of this document is to explain the quota implementation we have chosen. We tried to stick close to the draft ietf-webdav-quota ( http://tools.ietf.org/id/draft-ietf-webdav-quota-07.txt) but took the liberty of extending its specifications to meet our requirements. We tried to think about a secure and flexible quota system. We essentially focused on the flexibility and ease of use of quotas. We also wanted to separate the way quotas are configured/updated (how we put/update quota metadata), and the way they are managed by the server. The first part (Solution overview) explains the quota implementation we have chosen and the second part (Configuration - administration) explains the process we thought about to configure/administrate quotas on our WebDAV server. The two parts are independent.

2. Notational conventions

The terms “ virtual root ” and “ autonomous collection ” are equivalent. The terms “ metadata ” and “ properties ” are equivalent. The term “ quota ” refers to the DAV:quota-available-bytes metadata . The term “ used space ” refers to the DAV:quota-used-bytes metadata.

3. Solution overview

3.1. Metadata

We define three live protected properties DAV:quota-available-bytes DAV:quota-used-bytes and ESUP:virtual-root . These properties (called quota metadata in this document) can NOT be modified by a proppatch method (protected). These properties can be retrieved by a propfind method. If one of these properties is not protected, they are ignored by the server. The ESUP:virtual-root metadata is optional and is false if not present. Some collections contain these properties, but not necessary all. A collection either contains the two (DAV:) or three (DAV: ESUP:) properties or none of them at all. The DAV:quota-available-bytes and DAV:quota-used-bytes have the same meaning as in the draft ietf-webdav-quota – but we added the “virtual root” notion :

3.2. Compliance with the WebDAV quota RFC

We are 98% compliant with the WebDAV quota RFC. We differ on the following points :

3.3. Coherence

Rule 1 > The quota-available-bytes property of a collection CAN NOT be smaller than the sum of the quota-available-bytes properties of its sub-collections. Rule 2 > The quota-available-bytes property of a collection SHOULD NOT be smaller than its quota-used-bytes property - sometimes possible because of the "soft" quota management. Anyway, the following quota processing ensures that the server will not run anarchically if these rules are not respected.

3.4. Quota processing

3.4.1. Firstly without the notion of virtual root (autonomous collection)…

If a collection does not contain quota metadata, then it inherits them from its first parent containing quota metadata. If no quota metadata can be found (when the root collection is reached), this collection has no quota (unlimited quota). In concrete terms, when a new file “f” is about to be stored in a collection “C”:

3.4.2. Now the virtual root…

3.4.2.1. Why?

The rule 1 of the “coherence” section can be a bit rigid to handle quotas. Imagine that you have the following tree : /…/files/universityOfNorthPole/computerScienceDpt/teacherA /…/files/universityOfNorthPole/computerScienceDpt/teacherB /…/files/universityOfNorthPole/computerScienceDpt/teacherC /…/files/universityOfNorthPole/computerScienceDpt/… /…/files/universityOfNorthPole/computerScienceDpt/TeacherBigBoss The computerScienceDpt collection has a quota of 500MB (shared by all the teachers – or we could also have a quota for each teacher (in this case the rule 2 would have to be respected)). Imagine that you want now to give to the TeacherBigBoss collection a quota of 700MB (the boss works a lot ;-)):

3.4.2.2. How?

So it could be useful to define some collections as “autonomous” – as if the collection was the root collection (virtual root) – in this case the quota inheritance and coherence are broken:

In concrete terms, when a new file “f” is about to be stored in a collection “C”: - =( Final algorithm )=-

4. Configuration – administration

4.1. Requirements

To administrate quotas on our server we had the following requirements:

4.2. Solution 1

4.2.1. Configuration file

Quota are configured/modified by the following XML file:

<quotas>
 <quota> 
  <path="/files/university">
  <size="150MB"> 
  <init-used="true"> 
  <virtual-root="true"> 
 </quota> 
 <quota> 
 … 
 </quota> 
… 
</quotas> 

4.2.2. <path>

The path can be a common path ( /files/university ) but also a mask like /files/*/computer* . In this case the quota is applied to every collection with a depth of 3 and containing the word “computer”. Using this kind of mask is very useful to define in one rule a quota for several collections.

4.2.3. <init-used>

Specifies whether the quota-used-bytes metadata has to be calculated automatically or not when it does not exist. If false, the quota-used-bytes metadata is created and set to 0, if true, the quota-used-bytes metadata is created and calculated automatically.

4.2.4. Thread

A thread starting with the server reads the file every X minutes. If the file has not been modified it does nothing. If the file was modified, the thread detects each new or modified entry. For each resource to create or modify:

4.3. Solution 2

4.3.1. Web service

A Web service exports quota management functions to modify quota metadata.

4.3.2. Functions

The type of the funtion parameters can be modified. Get the quota-used-bytes MD of the given resource. getQuotaUsedBytes(String path); // not required given that propfind requests are allowed on this MD Get the quota-available-bytes MD of the given resource. getQuotaAvailableBytes(String path); // not required given that propfind requests are allowed on this MD Get the virtual-root MD of the given resource. getVirtualRoot(String path); // not required given that propfind requests are allowed on this MD Patch the quota-used-bytes MD of the given resource. Private funtion ? Failed if the MD does not exist. patchQuotaUsedBytes(String path, int value); Calculate the quota-used-bytes MD of the given resource - ! resource consuming process. calculateQuotaUsedBytes(String path); Patch the quota-available-bytes MD of the given resource. Failed if the MD does not exist. patchQuotaAvailableBytes(String path, int value); Set (and overwrite) the 2 DAV quota MD of the given resource. If calculateQuotaUsedBytes=true calculate the quota-used-bytes MD - ! resource consuming process. Else quota-used-bytes=0. setQuota(String path, int availableBytes, boolean calculateQuotaUsedBytes); Set (and overwrite) the virtual-root MD of the given resource. (Re)-calculate the quota-used-bytes MD of the parents resources up to the root node or first vitual root : > Modified from "true" to "false" : quota-used-bytes(PR) = quota-used-bytes(PR) + quota-used-bytes(CR) > Modified from "false" to "true" : quota-used-bytes(PR) = quota-used-bytes(PR) - quota-used-bytes(CR) PR = parent resources CR = current resource setVirtualRoot(String path, boolean value);

5. Notes