tkalkirill commented on code in PR #939: URL: https://github.com/apache/ignite-3/pull/939#discussion_r945502659
########## modules/api/src/main/java/org/apache/ignite/configuration/schemas/table/EntryCountBudgetConfigurationSchema.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.ignite.configuration.schemas.table; + +import org.apache.ignite.configuration.annotation.PolymorphicConfigInstance; +import org.apache.ignite.configuration.annotation.Value; + +/** + * Configuration for 'entry-count' log storage budget. + */ +@PolymorphicConfigInstance(EntryCountBudgetConfigurationSchema.NAME) +public class EntryCountBudgetConfigurationSchema extends LogStorageBudgetConfigurationSchema { + /** The budget name. */ + public static final String NAME = "entry-count"; + + /** Returns maximum number of entries allowed by the budget. */ Review Comment: I think there is a typo here. ########## modules/api/src/main/java/org/apache/ignite/configuration/schemas/table/VolatileRaftConfigurationSchema.java: ########## @@ -0,0 +1,31 @@ +/* + * 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.ignite.configuration.schemas.table; + +import org.apache.ignite.configuration.annotation.Config; +import org.apache.ignite.configuration.annotation.ConfigValue; + +/** + * Configuration for Raft group corresponding to tables. Review Comment: Can you specify what is for volatile? ########## modules/api/src/main/java/org/apache/ignite/configuration/schemas/table/LogStorageBudgetConfigurationSchema.java: ########## @@ -0,0 +1,31 @@ +/* + * 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.ignite.configuration.schemas.table; + +import org.apache.ignite.configuration.annotation.PolymorphicConfig; +import org.apache.ignite.configuration.annotation.PolymorphicId; + +/** + * Configuration schema for RAFT log storage budget. + */ +@PolymorphicConfig +public class LogStorageBudgetConfigurationSchema { + /** Name of data storage. */ Review Comment: I think there is a typo here. ########## modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/impl/VolatileLogStorageFactory.java: ########## @@ -17,15 +17,63 @@ package org.apache.ignite.internal.raft.storage.impl; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.ServiceLoader; +import java.util.Set; +import org.apache.ignite.configuration.schemas.table.LogStorageBudgetView; import org.apache.ignite.internal.raft.storage.LogStorageFactory; +import org.apache.ignite.lang.IgniteInternalException; +import org.apache.ignite.raft.jraft.core.LogStorageBudgetFactory; +import org.apache.ignite.raft.jraft.core.LogStorageBudgetsModule; import org.apache.ignite.raft.jraft.option.RaftOptions; import org.apache.ignite.raft.jraft.storage.LogStorage; import org.apache.ignite.raft.jraft.storage.impl.LocalLogStorage; +import org.apache.ignite.raft.jraft.storage.impl.LogStorageBudget; +import org.apache.ignite.raft.jraft.storage.impl.VolatileLogStorage; /** * Log storage factory based on {@link LocalLogStorage}. */ public class VolatileLogStorageFactory implements LogStorageFactory { + private final LogStorageBudgetView logStorageBudgetConfig; + + private final Map<String, LogStorageBudgetFactory> budgetFactories; + + /** + * Creates a new instance. + * + * @param logStorageBudgetConfig Budget config. + */ + public VolatileLogStorageFactory(LogStorageBudgetView logStorageBudgetConfig) { + this.logStorageBudgetConfig = logStorageBudgetConfig; + + Map<String, LogStorageBudgetFactory> factories = new HashMap<>(); + + ClassLoader serviceClassLoader = Thread.currentThread().getContextClassLoader(); + for (LogStorageBudgetsModule module : ServiceLoader.load(LogStorageBudgetsModule.class, serviceClassLoader)) { Review Comment: ```suggestion ClassLoader serviceClassLoader = Thread.currentThread().getContextClassLoader(); for (LogStorageBudgetsModule module : ServiceLoader.load(LogStorageBudgetsModule.class, serviceClassLoader)) { ``` -- 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]
