Hi, our application is a document management system(DMS) based out of Sling. 
We have a requirement to limit the amount of data(files/documents), in terms
of size, stored by a user in the datastore.  Each user can only upload to a
folder under say "/content/userA" or any of its sub-folders.  We also allow
versions on the documents, so I need to increment this size whenever a new
version is created on an existing document.  Also when a document is deleted
I need to decrement the size by calculating the size of the document and all
it's versions.

Considering the above requirement, I am thinking of is using the Event
mechanism and register for the events SlingConstants.TOPIC_RESOURCE_ADDED,
SlingConstants.TOPIC_RESOURCE_CHANGED,
SlingConstants.TOPIC_RESOURCE_REMOVED.

Whenever a document is uploaded or a new version is added to the DMS, I will
get the size of this document in the Event Handler and increment the size of
the User's usage.  However I am not sure if I can get all the version
history in the event handler when a document is deleted.  Please let me
know.

Is there a better alternative to the above approach?  Please suggest.

I am thinking of setting the current usage of a user as a property of the
folder "/content/userA".  Or would it be better to set as a property of the
User itself?






--
View this message in context: 
http://apache-sling.73963.n3.nabble.com/Datastore-usage-tp4048204.html
Sent from the Sling - Users mailing list archive at Nabble.com.

Reply via email to