-
Notifications
You must be signed in to change notification settings - Fork 228
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
addTransaction-removeTransaction #1338
Changes from 66 commits
47fc404
a574c9a
489f34a
18c0ea9
863b908
fe13372
f371289
fb5a5f9
536fd85
1080b23
d5fcfd2
c294b2e
76c32b0
4da0e0f
05bc1f9
b86a89a
8a63316
a4e13c1
8c67f5b
195a159
57a8d8a
ba25bb1
fcfdcb6
1558da4
214e16d
830f71c
550e456
947fc4a
15d7f91
1acc419
c04c053
cd110d6
5461fdc
fc7c63e
6669c9e
5fd1f6e
8caa043
53966a2
4b384ab
c5ddbb6
9ee68ed
d9689b8
6de50df
716e198
959808a
ed6d8e3
b306a0b
2091e66
1a564e4
e899393
e1e1ee0
5442e4d
a9760c4
2152ee0
dd022c1
8e7794c
c027cbd
862bbe5
862dd9c
c737e1c
da89038
a4ba910
89be875
e5016c6
9a41c0c
11c2708
52b4c61
3c5cdcd
8e73ca6
c10cfd4
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 |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
import java.io.Serializable; | ||
import java.util.Iterator; | ||
import java.util.Set; | ||
|
||
import java.util.UUID; | ||
/** | ||
* Wraps the Database Transaction type. | ||
*/ | ||
|
@@ -31,7 +31,6 @@ public enum FeatureSupport { | |
PARTIAL, | ||
NONE | ||
} | ||
|
||
/** | ||
* Save the updated object. | ||
* | ||
|
@@ -229,7 +228,7 @@ default Object getAttribute(Object entity, | |
* @param entity - The object which owns the attribute. | ||
* @param attribute - the attribute to set. | ||
* @param scope - contains request level metadata. | ||
*/ | ||
*/ | ||
default void setAttribute(Object entity, | ||
Attribute attribute, | ||
RequestScope scope) { | ||
|
@@ -263,4 +262,6 @@ default boolean supportsSorting(Class<?> entityClass, Sorting sorting) { | |
default boolean supportsPagination(Class<?> entityClass, FilterExpression expression) { | ||
return true; | ||
} | ||
|
||
UUID getRequestId(); | ||
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. Needs javadoc. |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright 2020, Yahoo Inc. | ||
* Licensed under the Apache License, Version 2.0 | ||
* See LICENSE file in project root for terms. | ||
*/ | ||
package com.yahoo.elide.core; | ||
|
||
import lombok.Getter; | ||
|
||
import java.util.UUID; | ||
|
||
public abstract class DataStoreTransactionImplementation implements DataStoreTransaction { | ||
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. Class needs javadoc. |
||
@Getter private final UUID requestId = UUID.randomUUID(); | ||
|
||
@Override | ||
public UUID getRequestId() { | ||
return requestId; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
package com.yahoo.elide.core.datastore.inmemory; | ||
|
||
import com.yahoo.elide.core.DataStoreTransaction; | ||
import com.yahoo.elide.core.DataStoreTransactionImplementation; | ||
import com.yahoo.elide.core.Path; | ||
import com.yahoo.elide.core.PersistentResource; | ||
import com.yahoo.elide.core.RequestScope; | ||
|
@@ -40,10 +41,9 @@ | |
* Data Store Transaction that wraps another transaction and provides in-memory filtering, soring, and pagination | ||
* when the underlying transaction cannot perform the equivalent function. | ||
*/ | ||
public class InMemoryStoreTransaction implements DataStoreTransaction { | ||
public class InMemoryStoreTransaction extends DataStoreTransactionImplementation { | ||
|
||
private final DataStoreTransaction tx; | ||
|
||
private static final Comparator<Object> NULL_SAFE_COMPARE = (a, b) -> { | ||
if (a == null && b == null) { | ||
return 0; | ||
|
@@ -119,7 +119,7 @@ public Object loadObject(EntityProjection projection, | |
projection.getFilterExpression()) == FeatureSupport.FULL) { | ||
return tx.loadObject(projection, id, scope); | ||
} else { | ||
return DataStoreTransaction.super.loadObject(projection, id, scope); | ||
return super.loadObject(projection, id, scope); | ||
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. I think this is wrong. This was calling the default method defined in the interface. You changed this to call the super class - which is something else - and will cause problems. |
||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,14 +14,16 @@ | |
|
||
import com.google.common.annotations.VisibleForTesting; | ||
|
||
import java.io.IOException; | ||
import lombok.Getter; | ||
|
||
import java.io.IOException; | ||
import java.util.UUID; | ||
/** | ||
* Transaction handler for {@link AggregationDataStore}. | ||
*/ | ||
public class AggregationDataStoreTransaction implements DataStoreTransaction { | ||
private QueryEngine queryEngine; | ||
|
||
@Getter private final UUID requestId = UUID.randomUUID(); | ||
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. Is there a reason this can't extend DataStoreTransactionImpl? |
||
public AggregationDataStoreTransaction(QueryEngine queryEngine) { | ||
this.queryEngine = queryEngine; | ||
} | ||
|
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.
We are storing requestId as a string in requestScope. Can we do the same here? or is there an advantage to storing it like this?
https://github.com/yahoo/elide/pull/1331/files
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.
We are using it as a key in a Map so I guess we can store it either way