-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IGNITE-21999] Merge partition free-lists into one #3615
Changes from 13 commits
8c24873
4acb234
b233247
d3fded8
f37c164
c52fc74
3509691
1f1a487
c1f2513
0f04c4a
7056d48
2411fc4
43816f7
141f0f1
fe29873
c953720
ee24f02
2c27776
bea0c40
86f61cb
f46f07b
614b73a
5a3d049
a8b9a10
817c898
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* 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.internal.util; | ||
|
||
import java.util.Iterator; | ||
|
||
/** {@link Iterator} implementation that allows to access the current element multiple times. */ | ||
public class CachedIterator<T> implements Iterator<T> { | ||
private final Iterator<? extends T> it; | ||
|
||
private T next; | ||
|
||
public CachedIterator(Iterator<? extends T> it) { | ||
this.it = it; | ||
} | ||
|
||
@Override | ||
public boolean hasNext() { | ||
return it.hasNext(); | ||
} | ||
|
||
@Override | ||
public T next() { | ||
next = it.next(); | ||
|
||
return next; | ||
} | ||
|
||
public T get() { | ||
return next; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,14 +17,22 @@ | |
|
||
package org.apache.ignite.internal.pagememory; | ||
|
||
import java.nio.ByteBuffer; | ||
import org.apache.ignite.internal.lang.IgniteInternalCheckedException; | ||
import org.apache.ignite.internal.pagememory.io.AbstractDataPageIo; | ||
import org.apache.ignite.internal.pagememory.io.DataPageIo; | ||
import org.apache.ignite.internal.pagememory.io.IoVersions; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
/** | ||
* Simple interface for data, store in some RowStore. | ||
*/ | ||
public interface Storable { | ||
/** Number of bytes a data type takes in storage. */ | ||
int DATA_TYPE_SIZE_BYTES = 1; | ||
|
||
/** Offset of data type from the beginning of the row. */ | ||
int DATA_TYPE_OFFSET = 0; | ||
|
||
/** | ||
* Sets link for this row. | ||
* | ||
|
@@ -59,5 +67,27 @@ public interface Storable { | |
/** | ||
* Returns I/O for handling this storable. | ||
*/ | ||
IoVersions<? extends AbstractDataPageIo<?>> ioVersions(); | ||
IoVersions<DataPageIo> ioVersions(); | ||
Phillippko marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** Returns a byte buffer that contains binary tuple data. */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Excuse me, what binary tuple? It's an abstraction, it should not depend on the implementation. There's clearly something wrong here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed, moved |
||
@Nullable | ||
ByteBuffer valueBuffer(); | ||
|
||
/** | ||
* Writes row header to page buffer and moves its pointer to {@link #valueOffset()}. | ||
* | ||
* @param pageBuf page buffer to write header to. | ||
*/ | ||
void writeHeader(ByteBuffer pageBuf); | ||
|
||
/** | ||
* Writes row header and value to page. | ||
* | ||
* @param pageAddr Page address. | ||
* @param offset Data offset. | ||
*/ | ||
void writeToPage(long pageAddr, int offset); | ||
|
||
/** Returns value offset from the start of the row. */ | ||
int valueOffset(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we shouldn't put it in
core
, this class is very specific.get
contract is weird and hard to explain, so I'd rather hide itThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
returned it back to FreeList file