1 package com.bradmcevoy.http;
2
3 /**
4 * Resource interface to support quota's
5 *
6 * This must be implemented by Collection (ie Folder) resources if you want to
7 * support quotas
8 *
9 * Resources which implement this can have their quota availability reported to
10 * client applications via the RFC4331 HTTP extensions
11 *
12 * See: http://www.faqs.org/rfcs/rfc4331.html
13 *
14 * Note that these properties may or may not be used in quota checking on PUT.
15 * The PutHandler delegates to a StorageChecker which might be configured to
16 * use a StorageChecker which uses this information.
17 *
18 * @author brad
19 */
20 public interface QuotaResource extends Resource {
21 /**
22 * From the spec:
23 *
24 * "The DAV:quota-used-bytes value is the value in octets representing
25 the amount of space used by this resource and possibly a number of
26 other similar resources, where the set of "similar" meets at least
27 the criterion that allocating space to any resource in the set will
28 count against the DAV:quota-available-bytes. It MUST include the
29 total count including usage derived from sub-resources if
30 appropriate. It SHOULD include metadata storage size if metadata
31 storage is counted against the DAV:quota-available-bytes.
32
33 Note that there may be a number of distinct but overlapping sets of
34 resources for which a DAV:quota-used-bytes is maintained (e.g., "all
35 files with a given owner", "all files with a given group owner",
36 etc.). The server is at liberty to choose any of those sets but
37 SHOULD do so in a repeatable way. The rule may be configured per
38 repository.
39
40
41 Read more: http://www.faqs.org/rfcs/rfc4331.html#ixzz0bnfikrSE
42 "
43 *
44 * @return - the number of bytes used in this quota allocation, or null
45 * to indicate this information is not available
46 */
47 Long getQuotaUsed();
48
49
50 /**
51 * From the spec:
52 *
53 The DAV:quota-available-bytes property value is the value in octets
54 representing the amount of additional disk space beyond the current
55 allocation that can be allocated to this resource before further
56 allocations will be refused. It is understood that this space may be
57 consumed by allocations to other resources.
58
59 Support for this property is REQUIRED on collections, and OPTIONAL on
60 other resources. A server SHOULD implement this property for each
61 resource that has the DAV:quota-used-bytes property.
62
63 Clients SHOULD expect that as the DAV:quota-available-bytes on a
64 resource approaches 0, further allocations to that resource may be
65 refused. A value of 0 indicates that users will probably not be able
66 to perform operations that write additional information (e.g., a PUT
67 inside a collection), but may be able to replace through overwrite an
68 existing resource of equal size.
69
70
71 Read more: http://www.faqs.org/rfcs/rfc4331.html#ixzz0bnfxRSVV
72 *
73 *
74 * @return - the number of bytes used in this quota allocation, or null
75 * to indicate this information is not available
76 */
77 Long getQuotaAvailable();
78 }