This repository was archived by the owner on Dec 19, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 174
use suro file's lastModify/dateCreated time for build upload path #147
Open
iPinYou
wants to merge
5
commits into
Netflix:master
Choose a base branch
from
iPinYou:ISSUE-140
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
fa43a3b
change RemotePrefixFormatter interface method
crnsnlzc 113a2c9
add `File` param for exist invocation
crnsnlzc 64ba50e
get createTime from fileName
crnsnlzc 65f06e5
add RemotePrefixFormatter of `FileDate` type
crnsnlzc 4c6d051
register FileDatePrefixFormatter.TYPE
crnsnlzc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
42 changes: 42 additions & 0 deletions
42
...-s3/src/main/java/com/netflix/suro/sink/remotefile/formatter/FileDatePrefixFormatter.java
This file contains hidden or 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,42 @@ | ||
| package com.netflix.suro.sink.remotefile.formatter; | ||
|
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. I need a copyright /*
|
||
|
|
||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
| import com.netflix.suro.sink.localfile.FileNameFormatter; | ||
| import com.netflix.suro.sink.remotefile.RemotePrefixFormatter; | ||
| import org.joda.time.DateTime; | ||
| import org.joda.time.format.DateTimeFormat; | ||
| import org.joda.time.format.DateTimeFormatter; | ||
|
|
||
| import java.io.File; | ||
|
|
||
| /** | ||
| * Created by liuzhenchuan@foxmail.com on 10/6/14. | ||
| */ | ||
| public class FileDatePrefixFormatter implements RemotePrefixFormatter{ | ||
|
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. We need the unit test for this class even though this class's logic is simple. |
||
| public static final String TYPE = "FileDate"; | ||
| private final DateTimeFormatter formatter; | ||
| //lastModify or dateCreated | ||
| private String dateType; | ||
|
|
||
| public FileDatePrefixFormatter(@JsonProperty("format") String formatString, | ||
| @JsonProperty("dateType") String dateType){ | ||
| formatter = DateTimeFormat.forPattern(formatString); | ||
| this.dateType = dateType; | ||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public String get(File file) { | ||
| String prefix = formatter.print(getDateCreated(file));//use dateCreated as default. | ||
| if("lastModify".equalsIgnoreCase(dateType)){ | ||
|
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.
|
||
| prefix = formatter.print(file.lastModified()); | ||
| } | ||
| if(!prefix.endsWith("/")) prefix += "/"; | ||
| return prefix; | ||
| } | ||
|
|
||
| private DateTime getDateCreated(File file){ | ||
| return FileNameFormatter.getFileCreateTime(file); | ||
| } | ||
|
|
||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why is P20141006T213521 hardcoded? This might need more explanation or comments.
I guess because of
private static DateTimeFormatter fmt = DateTimeFormat.forPattern("'P'yyyyMMdd'T'HHmmss");could you add comments?