Arsnael commented on code in PR #1673: URL: https://github.com/apache/james-project/pull/1673#discussion_r1292974536
########## mailbox/api/src/main/java/org/apache/james/mailbox/quota/QuotaCurrentValueDao.java: ########## @@ -0,0 +1,34 @@ +/**************************************************************** + * Licensed to the Apache Software Foundation (ASF) under one * + * or more contributor license agreements. See the NOTICE file * + * distributed with this work for additional information * + * regarding copyright ownership. The ASF licenses this file * + * to you under the Apache License, Version 2.0 (the * + * "License"); you may not use this file except in compliance * + * with the License. You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, * + * software distributed under the License is distributed on an * + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * + * KIND, either express or implied. See the License for the * + * specific language governing permissions and limitations * + * under the License. * + ****************************************************************/ + +package org.apache.james.mailbox.quota; + +import org.apache.james.core.Username; +import org.apache.james.core.quota.QuotaComponent; +import org.apache.james.core.quota.QuotaCurrentValue; +import org.apache.james.core.quota.QuotaType; + +import reactor.core.publisher.Mono; + +public interface QuotaCurrentValueDao { + Mono<Void> increase(QuotaComponent quotaComponent, Username identifier, QuotaType quotaType, long amount); + Mono<Void> decrease(QuotaComponent quotaComponent, Username identifier, QuotaType quotaType, long amount); + Mono<QuotaCurrentValue> getQuotaCurrentValue(QuotaComponent quotaComponent, Username identifier, QuotaType quotaType); Review Comment: Ok for `QuotaRoot`, actually I prefer not dealing with IMAP notions TBH... But `Username`? It's at the core of James, we have that everywhere in our other DAOs, and we only keep track of users current quotas, not anything else. I don't see what would be wrong to use that here? Everything revolves around the `Username`. That would complexify quite a lot `QuotaScope` as well? I don't see a good way of having the scope it covers and the user or domain all together, adding the global scope in the melee as well... Something like (pseudo code): ``` QuotaScope(String value, Optional<Username> username) OR QuotaScope(Optional<Username> username) ``` ? second option meaning extra treatment to determine if it's global, domain or account, first one would seem just for not seeing directly Username hanging around in the DAO api while it would be this under the hood in QuotaScope... And any further tinkering would just seem adding complexity to me -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
