Skip to content

Commit

Permalink
Move idConverter inside of router phase1 (linkedin#2894)
Browse files Browse the repository at this point in the history
Co-authored-by: Sophie Guo <sopguo@sopguo-mn2.linkedin.biz>
  • Loading branch information
SophieGuo410 and Sophie Guo authored Sep 17, 2024
1 parent bc11761 commit bbdfd5c
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.github.ambry.messageformat.BlobProperties;
import com.github.ambry.commons.Callback;
import com.github.ambry.quota.QuotaChargeCallback;
import com.github.ambry.rest.RestRequest;
import com.github.ambry.router.ChunkInfo;
import com.github.ambry.router.FutureResult;
import com.github.ambry.router.GetBlobOptions;
Expand Down Expand Up @@ -100,7 +101,7 @@ public Future<GetBlobResult> getBlob(String blobId, GetBlobOptions options, Call

@Override
public Future<String> putBlob(BlobProperties blobProperties, byte[] userMetadata, ReadableStreamChannel channel,
PutBlobOptions options, Callback<String> callback, QuotaChargeCallback quotaChargeCallback, String blobPath) {
PutBlobOptions options, Callback<String> callback, QuotaChargeCallback quotaChargeCallback, RestRequest restRequest) {
lock.lock();
try {
FutureResult<String> future = new FutureResult<>();
Expand Down
5 changes: 3 additions & 2 deletions ambry-api/src/main/java/com/github/ambry/router/Router.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.github.ambry.messageformat.BlobInfo;
import com.github.ambry.messageformat.BlobProperties;
import com.github.ambry.quota.QuotaChargeCallback;
import com.github.ambry.rest.RestRequest;
import com.github.ambry.utils.Utils;
import java.io.Closeable;
import java.io.IOException;
Expand Down Expand Up @@ -56,11 +57,11 @@ Future<GetBlobResult> getBlob(String blobId, GetBlobOptions options, Callback<Ge
* @param options The {@link PutBlobOptions} associated with the request. This cannot be null.
* @param callback The {@link Callback} which will be invoked on the completion of the request .
* @param quotaChargeCallback Listener interface to charge quota cost for the operation.
* @param blobPath The name of the blob path for named blob based upload.
* @param restRequest The {@link RestRequest} to put the blob.
* @return A future that would contain the BlobId eventually.
*/
Future<String> putBlob(BlobProperties blobProperties, byte[] userMetadata, ReadableStreamChannel channel,
PutBlobOptions options, Callback<String> callback, QuotaChargeCallback quotaChargeCallback, String blobPath);
PutBlobOptions options, Callback<String> callback, QuotaChargeCallback quotaChargeCallback, RestRequest restRequest);

/**
* Requests for a new metadata blob to be put asynchronously and invokes the {@link Callback} when the request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ private Callback<Void> securityPostProcessRequestCallback(BlobInfo blobInfo) {
PutBlobOptions options = getPutBlobOptionsFromRequest();
router.putBlob(getPropertiesForRouterUpload(blobInfo), blobInfo.getUserMetadata(), restRequest, options,
routerPutBlobCallback(blobInfo), QuotaUtils.buildQuotaChargeCallback(restRequest, quotaManager, true),
RestUtils.getRequestPath(restRequest).getOperationOrBlobId(false));
restRequest);
}
}, uri, LOGGER, deleteDatasetCallback);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4411,7 +4411,7 @@ public Future<GetBlobResult> getBlob(String blobId, GetBlobOptions options, Call

@Override
public Future<String> putBlob(BlobProperties blobProperties, byte[] usermetadata, ReadableStreamChannel channel,
PutBlobOptions options, Callback<String> callback, QuotaChargeCallback quotaChargeCallback, String blobPath) {
PutBlobOptions options, Callback<String> callback, QuotaChargeCallback quotaChargeCallback, RestRequest restRequest) {
return completeOperation(TestUtils.getRandomString(10), callback, OpType.PutBlob);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.github.ambry.quota.QuotaChargeCallback;
import com.github.ambry.repair.RepairRequestsDb;
import com.github.ambry.repair.RepairRequestsDbFactory;
import com.github.ambry.rest.RestRequest;
import com.github.ambry.store.StoreKey;
import com.github.ambry.utils.Time;
import com.github.ambry.utils.Utils;
Expand Down Expand Up @@ -354,12 +355,12 @@ public Future<GetBlobResult> getBlob(String blobIdStr, GetBlobOptions options, f
* @param channel The {@link ReadableStreamChannel} that contains the content of the blob.
* @param options The {@link PutBlobOptions} associated with the request. This cannot be null.
* @param callback The {@link Callback} which will be invoked on the completion of the request .
* @param blobPath The name of the blob path for named blob based upload.
* @param restRequest The {@link RestRequest} to put the blob.
* @return A future that would contain the BlobId eventually.
*/
@Override
public Future<String> putBlob(BlobProperties blobProperties, byte[] userMetadata, ReadableStreamChannel channel,
PutBlobOptions options, Callback<String> callback, QuotaChargeCallback quotaChargeCallback, String blobPath) {
PutBlobOptions options, Callback<String> callback, QuotaChargeCallback quotaChargeCallback, RestRequest restRequest) {
if (blobProperties == null || channel == null || options == null) {
throw new IllegalArgumentException("blobProperties, channel, or options must not be null");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.github.ambry.notification.NotificationSystem;
import com.github.ambry.protocol.GetOption;
import com.github.ambry.quota.QuotaChargeCallback;
import com.github.ambry.rest.RestRequest;
import com.github.ambry.store.StoreKey;
import com.github.ambry.utils.Pair;
import com.github.ambry.utils.SystemTime;
Expand Down Expand Up @@ -259,7 +260,7 @@ public Future<GetBlobResult> getBlob(String blobId, GetBlobOptions options, Call

@Override
public Future<String> putBlob(BlobProperties blobProperties, byte[] usermetadata, ReadableStreamChannel channel,
PutBlobOptions options, Callback<String> callback, QuotaChargeCallback quotaChargeCallback, String blobPath) {
PutBlobOptions options, Callback<String> callback, QuotaChargeCallback quotaChargeCallback, RestRequest restRequest) {
FutureResult<String> futureResult = new FutureResult<>();
if (!handlePrechecks(futureResult, callback)) {
return futureResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.github.ambry.messageformat.BlobInfo;
import com.github.ambry.messageformat.BlobProperties;
import com.github.ambry.quota.QuotaChargeCallback;
import com.github.ambry.rest.RestRequest;
import com.github.ambry.router.ChunkInfo;
import com.github.ambry.router.FutureResult;
import com.github.ambry.router.GetBlobOptions;
Expand Down Expand Up @@ -108,12 +109,12 @@ public Future<GetBlobResult> getBlob(String blobId, GetBlobOptions options, Call
* @param channel The {@link ReadableStreamChannel} that contains the content of the blob.
* @param options the {@link PutBlobOptions} for the blob.
* @param callback the {@link Callback} to invoke on operation completion.
* @param blobPath The name of the blob path for named blob based upload.
* @param restRequest The name of the blob path for named blob based upload.
* @return a {@link Future} that will contain a (dummy) blob id.
*/
@Override
public Future<String> putBlob(BlobProperties blobProperties, byte[] usermetadata, final ReadableStreamChannel channel,
PutBlobOptions options, final Callback<String> callback, QuotaChargeCallback quotaChargeCallback, String blobPath) {
PutBlobOptions options, final Callback<String> callback, QuotaChargeCallback quotaChargeCallback, RestRequest restRequest) {
logger.trace("Received putBlob call");
final FutureResult<String> futureResult = new FutureResult<String>();
if (!routerOpen) {
Expand Down

0 comments on commit bbdfd5c

Please sign in to comment.