Package com.github.ambry.quota.storage
Interface StorageUsageRefresher
-
public interface StorageUsageRefresher
An interface to initialize the storage usage of each container and save them in memory. It should also refresh the in memory cache if there is any change of storage usage.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
StorageUsageRefresher.Listener
A listener interface registered withStorageUsageRefresher
.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Long>>
getContainerStorageUsage()
Return the current storage usage for each container.void
registerListener(StorageUsageRefresher.Listener listener)
Register your listener toStorageUsageRefresher
.
-
-
-
Method Detail
-
getContainerStorageUsage
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Long>> getContainerStorageUsage() throws java.lang.Exception
Return the current storage usage for each container. The returned map should be structured as such: The key of the map is the account id in string format and the value of the map is the storage usage of each container under this account. The container usage map's key is the container is in string format, and the value is storage usage of this container.- Returns:
- The current storage usage for each container.
- Throws:
java.lang.Exception
-
registerListener
void registerListener(StorageUsageRefresher.Listener listener)
Register your listener toStorageUsageRefresher
. A refresher should only have one callback and it can't be registered multiple times.- Parameters:
listener
- The listener to register.
-
-