Rename function for clarity

This commit is contained in:
Sajith Sasidharan 2020-02-12 12:14:24 -05:00
parent 227d06fe64
commit f22417e51b

View File

@ -47,7 +47,7 @@ class StorageStatusElement(Element):
return tag("No storage server running.")
return idlib.nodeid_b2a(self.storage.my_nodeid)
def get_stat(self, key):
def _get_storage_stat(self, key):
if not self.storage:
return None
return self.storage.get_stats().get(key)
@ -64,67 +64,67 @@ class StorageStatusElement(Element):
@renderer
def disk_total(self, req, tag):
val = self.get_stat("storage_server.disk_total")
val = self._get_storage_stat("storage_server.disk_total")
return tag(self.render_space(val))
@renderer
def disk_total_abbrev(self, req, tag):
val = self.get_stat("storage_server.disk_total")
val = self._get_storage_stat("storage_server.disk_total")
return tag(self.render_abbrev_space(val))
@renderer
def disk_used(self, req, tag):
val = self.get_stat("storage_server.disk_used")
val = self._get_storage_stat("storage_server.disk_used")
return tag(self.render_space(val))
@renderer
def disk_used_abbrev(self, req, tag):
val = self.get_stat("storage_server.disk_used")
val = self._get_storage_stat("storage_server.disk_used")
return tag(self.render_abbrev_space(val))
@renderer
def disk_free_for_root(self, req, tag):
val = self.get_stat("storage_server.disk_free_for_root")
val = self._get_storage_stat("storage_server.disk_free_for_root")
return tag(self.render_space(val))
@renderer
def disk_free_for_root_abbrev(self, req, tag):
val = self.get_stat("storage_server.disk_free_for_root")
val = self._get_storage_stat("storage_server.disk_free_for_root")
return tag(self.render_abbrev_space(val))
@renderer
def disk_free_for_nonroot(self, req, tag):
val = self.get_stat("storage_server.disk_free_for_nonroot")
val = self._get_storage_stat("storage_server.disk_free_for_nonroot")
return tag(self.render_space(val))
@renderer
def disk_free_for_nonroot_abbrev(self, req, tag):
val = self.get_stat("storage_server.disk_free_for_nonroot")
val = self._get_storage_stat("storage_server.disk_free_for_nonroot")
return tag(self.render_abbrev_space(val))
@renderer
def reserved_space(self, req, tag):
val = self.get_stat("storage_server.reserved_space")
val = self._get_storage_stat("storage_server.reserved_space")
return tag(self.render_space(val))
@renderer
def reserved_space_abbrev(self, req, tag):
val = self.get_stat("storage_server.reserved_space")
val = self._get_storage_stat("storage_server.reserved_space")
return tag(self.render_abbrev_space(val))
@renderer
def disk_avail(self, req, tag):
val = self.get_stat("storage_server.disk_avail")
val = self._get_storage_stat("storage_server.disk_avail")
return tag(self.render_space(val))
@renderer
def disk_avail_abbrev(self, req, tag):
val = self.get_stat("storage_server.disk_avail")
val = self._get_storage_stat("storage_server.disk_avail")
return tag(self.render_abbrev_space(val))
@renderer
def accepting_immutable_shares(self, req, tag):
accepting = self.get_stat("storage_server.accepting_immutable_shares")
accepting = self._get_storage_stat("storage_server.accepting_immutable_shares")
return {True: "Yes", False: "No"}[bool(accepting)]
@renderer