tkalkirill commented on code in PR #939:
URL: https://github.com/apache/ignite-3/pull/939#discussion_r940919316


##########
modules/raft/src/main/java/org/apache/ignite/raft/jraft/core/LogStorageBudgetsModule.java:
##########
@@ -0,0 +1,35 @@
+/*
+ * 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.raft.jraft.core;
+
+import java.util.Map;
+import java.util.function.Function;
+import org.apache.ignite.configuration.schemas.table.LogStorageBudgetView;
+import org.apache.ignite.raft.jraft.storage.impl.LogStorageBudget;
+
+/**
+ * Used to add {@link LogStorageBudget} factories using {@link 
java.util.ServiceLoader}.
+ */
+public interface LogStorageBudgetsModule {
+    /**
+     * Returns mapping from budget names to budget factories for the budgets 
supported by this module.
+     *
+     * @return Mapping from budget names to budget factories for the budgets 
supported by this module.

Review Comment:
   ```suggestion
   ```



##########
modules/raft/src/main/java/org/apache/ignite/raft/jraft/core/LogStorageBudgetsModule.java:
##########
@@ -0,0 +1,35 @@
+/*
+ * 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.raft.jraft.core;
+
+import java.util.Map;
+import java.util.function.Function;
+import org.apache.ignite.configuration.schemas.table.LogStorageBudgetView;
+import org.apache.ignite.raft.jraft.storage.impl.LogStorageBudget;
+
+/**
+ * Used to add {@link LogStorageBudget} factories using {@link 
java.util.ServiceLoader}.
+ */
+public interface LogStorageBudgetsModule {
+    /**
+     * Returns mapping from budget names to budget factories for the budgets 
supported by this module.
+     *
+     * @return Mapping from budget names to budget factories for the budgets 
supported by this module.
+     */
+    Map<String, Function<? super LogStorageBudgetView, LogStorageBudget>> 
budgetFactories();

Review Comment:
   Why not create a separate factory interface? it is also not necessary to 
take the form, you can just config.



##########
modules/raft/src/main/java/org/apache/ignite/raft/jraft/storage/impl/UnlimitedBudget.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.raft.jraft.storage.impl;
+
+import org.apache.ignite.raft.jraft.entity.LogEntry;
+
+/**
+ * {@link LogStorageBudget} that always allows everything.
+ */
+public class UnlimitedBudget implements LogStorageBudget {
+

Review Comment:
   ```suggestion
   ```



##########
modules/raft/src/main/java/org/apache/ignite/raft/jraft/storage/impl/LogStorageBudget.java:
##########
@@ -0,0 +1,79 @@
+/*
+ * 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.raft.jraft.storage.impl;
+
+import java.util.List;
+import org.apache.ignite.raft.jraft.entity.LogEntry;
+
+/**
+ * Knows how to determine whether there is still room for more log entries.
+ */
+public interface LogStorageBudget {
+    /**
+     * Returns {@code true} if there is room for the given entry, {@code 
false} otherwise.
+     *
+     * @param entry Entry that is tried to be appended.
+     * @return {@code true} if there is room for the given entry, {@code 
false} otherwise.

Review Comment:
   ```suggestion
   ```



##########
modules/api/src/main/java/org/apache/ignite/configuration/schemas/table/TableConfigurationSchema.java:
##########
@@ -61,4 +61,8 @@ public class TableConfigurationSchema {
     /** Indices configuration. */
     @NamedConfigValue
     public TableIndexConfigurationSchema indices;
+
+    /** Configuration for Raft groups corresponding to table partitions. */
+    @ConfigValue
+    public RaftConfigurationSchema raft;

Review Comment:
   How is this related to the table and how can the user configure it?
   I think it should be taken out in a configuration where it is spoken about 
the table in-memory.



##########
modules/raft/src/main/java/org/apache/ignite/raft/jraft/storage/impl/EntryCountBudget.java:
##########
@@ -0,0 +1,96 @@
+/*
+ * 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.raft.jraft.storage.impl;
+
+import java.util.List;
+import org.apache.ignite.raft.jraft.entity.LogEntry;
+
+/**
+ * {@link LogStorageBudget} that makes sure that no more entries than the 
provided limit is stored.
+ */
+public class EntryCountBudget implements LogStorageBudget {

Review Comment:
   Write in the documentation about it.



##########
modules/api/src/main/java/org/apache/ignite/configuration/schemas/table/EntryCountBudgetConfigurationSchema.java:
##########
@@ -0,0 +1,33 @@
+/*
+ * 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 'unlimited' log storage budget.
+ */
+@PolymorphicConfigInstance(EntryCountBudgetConfigurationSchema.NAME)
+public class EntryCountBudgetConfigurationSchema extends 
LogStorageBudgetConfigurationSchema {
+    /** The budget name. */
+    public static final String NAME = "entry-count";
+
+    @Value
+    public long entriesCountLimit;

Review Comment:
   Please add javadoc



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to