-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add datasegment copier interface and s3 impl
- Loading branch information
1 parent
73675d0
commit 49c7941
Showing
5 changed files
with
632 additions
and
207 deletions.
There are no files selected for viewing
62 changes: 62 additions & 0 deletions
62
...ons-core/s3-extensions/src/main/java/org/apache/druid/storage/s3/S3DataSegmentCopier.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* 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.druid.storage.s3; | ||
|
||
import com.google.common.base.Supplier; | ||
import com.google.inject.Inject; | ||
import org.apache.druid.java.util.common.logger.Logger; | ||
import org.apache.druid.segment.loading.DataSegmentCopier; | ||
import org.apache.druid.segment.loading.SegmentLoadingException; | ||
import org.apache.druid.timeline.DataSegment; | ||
|
||
import java.util.Map; | ||
|
||
public class S3DataSegmentCopier extends S3DataSegmentTransferUtility implements DataSegmentCopier | ||
{ | ||
private static final Logger log = new Logger(S3DataSegmentCopier.class); | ||
|
||
/** | ||
* Any implementation of DataSegmentCopier is initialized when an ingestion job starts if the extension is loaded | ||
* even when the implementation of DataSegmentCopier is not used. As a result, if we accept a s3 client instead | ||
* of a supplier of it, it can cause unnecessary config validation for s3 even when it's not used at all. | ||
* To perform the config validation only when it is actually used, we use a supplier. | ||
* | ||
* See OmniDataSegmentCopier for how DataSegmentCopiers are initialized. | ||
*/ | ||
@Inject | ||
public S3DataSegmentCopier( | ||
Supplier<ServerSideEncryptingAmazonS3> s3ClientSupplier, | ||
S3DataSegmentPusherConfig config | ||
) | ||
{ | ||
super(config, s3ClientSupplier); | ||
} | ||
|
||
@Override | ||
public DataSegment copy(DataSegment segment, Map<String, Object> targetLoadSpec) throws SegmentLoadingException | ||
{ | ||
return this.transfer(segment, targetLoadSpec, false); | ||
} | ||
|
||
@Override | ||
protected Logger log() { | ||
return log; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.