Skip to content

Commit

Permalink
Rename "private" to "user-defined" sources
Browse files Browse the repository at this point in the history
To avoid confusion with "private" as in "not shareable" object stores.
And to make it clear that these are user-defined object stores.
  • Loading branch information
davelopez committed Jan 13, 2025
1 parent c4a6b30 commit 50ebdcc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions lib/galaxy/objectstore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1756,16 +1756,16 @@ def __init__(self, source=DEFAULT_QUOTA_SOURCE, enabled=DEFAULT_QUOTA_ENABLED):
self.default_quota_source = source
self.default_quota_enabled = enabled
self.info = QuotaSourceInfo(self.default_quota_source, self.default_quota_enabled)
# Private sources are provided by the user and the quota is not tracked
self.private_source_info = QuotaSourceInfo(label=None, use=False)
# User defined sources are provided by the user and the quota is not tracked
self.user_defined_source_info = QuotaSourceInfo(label=None, use=False)
self.backends = {}
self._labels = None

def get_quota_source_info(self, object_store_id: Optional[str]) -> QuotaSourceInfo:
if object_store_id in self.backends:
return self.backends[object_store_id].get_quota_source_info(object_store_id)
elif self._is_private_source(object_store_id):
return self.private_source_info
elif self._is_user_defined_source(object_store_id):
return self.user_defined_source_info
else:
return self.info

Expand Down Expand Up @@ -1813,7 +1813,7 @@ def ids_per_quota_source(self, include_default_quota_source=False):
quota_sources[quota_source_label].append(object_id)
return quota_sources

def _is_private_source(self, object_store_id: Optional[str]) -> bool:
def _is_user_defined_source(self, object_store_id: Optional[str]) -> bool:
return object_store_id is not None and object_store_id.startswith("user_objects://")


Expand Down
2 changes: 1 addition & 1 deletion test/unit/data/test_quota.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def test_calculate_usage_with_user_provided_storage(self):

self._add_dataset(10)
# This dataset should not be counted towards the user's disk usage
self._add_dataset(30, object_store_id="user_objects://private/user/storage")
self._add_dataset(30, object_store_id="user_objects://user/provided/storage")

object_store = MockObjectStore()
assert u.calculate_disk_usage_default_source(object_store) == 10
Expand Down

0 comments on commit 50ebdcc

Please sign in to comment.