-
Notifications
You must be signed in to change notification settings - Fork 115
Change DataInKeySpacePath to contain a KeySpacePath instead of ResolvedKeySpacePath #3716
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
Changes from 2 commits
568fd9a
3b03b15
5bf455e
a024330
7ab2cb8
ea1b57a
007f37b
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 |
|---|---|---|
|
|
@@ -25,9 +25,10 @@ | |
| import com.apple.foundationdb.record.RecordCoreArgumentException; | ||
| import com.apple.foundationdb.record.logging.LogMessageKeys; | ||
| import com.apple.foundationdb.record.provider.foundationdb.FDBRecordContext; | ||
| import com.apple.foundationdb.tuple.ByteArrayUtil2; | ||
| import com.apple.foundationdb.tuple.Tuple; | ||
|
|
||
| import javax.annotation.Nonnull; | ||
| import javax.annotation.Nullable; | ||
| import java.util.concurrent.CompletableFuture; | ||
|
|
||
| /** | ||
|
|
@@ -37,24 +38,45 @@ | |
| public class DataInKeySpacePath { | ||
|
|
||
| @Nonnull | ||
| private final CompletableFuture<ResolvedKeySpacePath> resolvedPath; | ||
| private final KeySpacePath path; | ||
| @Nullable | ||
| private final Tuple remainder; | ||
| @Nonnull | ||
| private final byte[] value; | ||
|
|
||
| public DataInKeySpacePath(KeySpacePath path, KeyValue rawKeyValue, FDBRecordContext context) { | ||
| this.resolvedPath = path.toResolvedPathAsync(context, rawKeyValue.getKey()); | ||
| this.value = rawKeyValue.getValue(); | ||
| if (this.value == null) { | ||
| public DataInKeySpacePath(@Nonnull final KeySpacePath path, @Nullable final Tuple remainder, | ||
| @Nullable final byte[] value) { | ||
| this.path = path; | ||
| this.remainder = remainder; | ||
| if (value == null) { | ||
| throw new RecordCoreArgumentException("Value cannot be null") | ||
| .addLogInfo(LogMessageKeys.KEY, ByteArrayUtil2.loggable(rawKeyValue.getKey())); | ||
| .addLogInfo(LogMessageKeys.KEY, path); | ||
| } | ||
| } | ||
|
|
||
| public CompletableFuture<ResolvedKeySpacePath> getResolvedPath() { | ||
| return resolvedPath; | ||
| this.value = value; | ||
|
Check warning on line 55 in fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/provider/foundationdb/keyspace/DataInKeySpacePath.java
|
||
| } | ||
|
|
||
| public byte[] getValue() { | ||
| return this.value; | ||
|
Check warning on line 59 in fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/provider/foundationdb/keyspace/DataInKeySpacePath.java
|
||
| } | ||
|
|
||
| @Nonnull | ||
| public KeySpacePath getPath() { | ||
| return path; | ||
| } | ||
|
|
||
| @Nullable | ||
| public Tuple getRemainder() { | ||
| return remainder; | ||
| } | ||
|
|
||
| /** | ||
| * Converts this data item to a {@link ResolvedKeySpacePath} by resolving the path and applying the remainder. | ||
| * @param context the context to use for resolving the path | ||
| * @return a future that completes with the resolved path including the remainder | ||
| */ | ||
| @Nonnull | ||
| public CompletableFuture<ResolvedKeySpacePath> getResolvedPath(@Nonnull FDBRecordContext context) { | ||
|
||
| return path.toResolvedPathAsync(context) | ||
|
||
| .thenApply(resolvedPath -> remainder == null ? resolvedPath : resolvedPath.withRemainder(remainder)); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,7 +24,6 @@ | |
| import com.apple.foundationdb.subspace.Subspace; | ||
| import com.apple.foundationdb.tuple.ByteArrayUtil2; | ||
| import com.apple.foundationdb.tuple.Tuple; | ||
| import com.google.common.annotations.VisibleForTesting; | ||
|
|
||
| import javax.annotation.Nonnull; | ||
| import javax.annotation.Nullable; | ||
|
|
@@ -279,7 +278,6 @@ public static void appendValue(StringBuilder sb, Object value) { | |
| * @return a new {@code ResolvedKeySpacePath} that is the same as this, except with a different {@link #getRemainder()}. | ||
| */ | ||
| @Nonnull | ||
| @VisibleForTesting | ||
|
Contributor
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. if |
||
| ResolvedKeySpacePath withRemainder(@Nullable final Tuple newRemainder) { | ||
| // this could probably copy the cachedTuple & cachedSubspace | ||
| return new ResolvedKeySpacePath(parent, inner, value, newRemainder); | ||
|
|
||
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.
Instead of copying the
byte[]here and ingetValue, I created an issue to convert it toByteString: #3717