# leases do not have arbitrary boundaries
# f_from and t_until are rounded to this period of time
- # initial model is one hour
- granularity = 60*60
+ # initial model is 15 minutes
+# granularity = 15*60 granularity = 5*60
def validate_time (self, timestamp, round_up):
# convert to long
--- /dev/null
+# $Id$
+# $URL$
+from PLC.Method import Method
+from PLC.Auth import Auth
+from PLC.Faults import *
+from PLC.Parameter import Parameter
+from PLC.Leases import Lease
+
+class GetLeaseGranularity(Method):
+ """
+ Returns the granularity in seconds for the reservation system
+ """
+
+ roles = ['admin', 'pi', 'user', 'tech', 'node', 'anonymous']
+
+ accepts = [
+ Auth(),
+ ]
+
+ # for now only return /etc/myplc-release verbatim
+ returns = Parameter (int, "the granularity in seconds for the reservation system")
+
+ def call(self, auth):
+
+ return Lease.granularity
'clip': (timestamp, timestamp+24*Duration.HOUR),
'-SORT': 't_from',
}) ]
+ granularity=Lease.granularity
return {
'timestamp': timestamp,
'hrn':hrn,
'reservation_policy': reservation_policy,
'leases':leases,
+ 'lease_granularity': granularity,
}