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


##########
modules/raft/src/main/java/org/apache/ignite/raft/jraft/storage/impl/EntryCountBudget.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * 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.
+ *
+ * <p>This is not thread safe as {@link LogStorageBudget} implementations do 
not need to be thread safe (because all budget methods
+ * are called under locks).
+ */
+public class EntryCountBudget implements LogStorageBudget {
+
+    private static final long NO_INDEX = -1;
+
+    private final long entriesCountLimit;
+
+    private long firstIndex = NO_INDEX;
+    private long lastIndex = NO_INDEX;
+
+    public EntryCountBudget(long entriesCountLimit) {
+        this.entriesCountLimit = entriesCountLimit;
+    }
+
+    @Override
+    public boolean hasRoomFor(LogEntry entry) {

Review Comment:
   Later, we'll have another implementation that will account for total entries 
size, it will need entry.



-- 
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