forked from apache/flink
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FLINK-17593][fs-connector] Support arbitrary recovery mechanism for …
…PartFileWriter This change includes two things: 1. Make the PartFileWriter generic and decouple the PartFileWriter and RecoverableStream. According to different pre-commit / commit methods, this change allows us to extend different types of PartFileWriter. 2. Make the Bucket/Buckets depends on the PartFileFactory instead of RecoverableWriter. This closes apache#12132
- Loading branch information
1 parent
cc8bf34
commit 339f5d8
Showing
57 changed files
with
1,232 additions
and
563 deletions.
There are no files selected for viewing
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
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
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
58 changes: 58 additions & 0 deletions
58
...java/org/apache/flink/streaming/api/functions/sink/filesystem/AbstractPartFileWriter.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,58 @@ | ||
/* | ||
* 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.flink.streaming.api.functions.sink.filesystem; | ||
|
||
/** | ||
* An abstract writer for the currently open part file in a specific {@link Bucket}. | ||
* @param <IN> the element type. | ||
* @param <BucketID> the bucket id type. | ||
*/ | ||
public abstract class AbstractPartFileWriter<IN, BucketID> implements InProgressFileWriter<IN, BucketID> { | ||
|
||
private final BucketID bucketID; | ||
|
||
private final long creationTime; | ||
|
||
private long lastUpdateTime; | ||
|
||
public AbstractPartFileWriter(final BucketID bucketID, final long createTime) { | ||
this.bucketID = bucketID; | ||
this.creationTime = createTime; | ||
this.lastUpdateTime = createTime; | ||
} | ||
|
||
@Override | ||
public BucketID getBucketId() { | ||
return bucketID; | ||
} | ||
|
||
@Override | ||
public long getCreationTime() { | ||
return creationTime; | ||
} | ||
|
||
@Override | ||
public long getLastUpdateTime() { | ||
return lastUpdateTime; | ||
} | ||
|
||
void markWrite(long now) { | ||
this.lastUpdateTime = now; | ||
} | ||
} |
Oops, something went wrong.