gerlowskija commented on code in PR #1704:
URL: https://github.com/apache/solr/pull/1704#discussion_r1242677061
##########
solr/core/src/java/org/apache/solr/handler/admin/api/CoreReplicationAPI.java:
##########
@@ -88,4 +90,137 @@ public IndexVersionResponse(Long indexVersion, Long
generation, String status) {
this.status = status;
}
}
+
+ /** Response for {@link CoreReplicationAPI#fetchFileList(long)}. */
+ public static class FileListResponse extends SolrJerseyResponse {
+ @JsonProperty("filelist")
+ public List<FileMetaData> fileList;
+
+ @JsonProperty("confFiles")
+ public List<FileMetaData> confFiles;
+
+ @JsonProperty("status")
+ public String status;
+
+ @JsonProperty("message")
+ public String message;
+
+ @JsonProperty("exception")
+ public Exception exception;
+
+ public FileListResponse() {}
+
+ public void addToFileList(List<FileMetaData> fileMetaData) {
+ if (fileList == null) {
+ fileList = new ArrayList<>();
+ }
+ fileList.addAll(fileMetaData);
+ }
+
+ public void addToConfFiles(List<FileMetaData> confFilesMetaData) {
+ if (confFiles == null) {
+ confFiles = new ArrayList<>();
+ }
+ confFiles.addAll(confFilesMetaData);
+ }
+
+ public void setFileList(List<FileMetaData> fileList) {
Review Comment:
[Q] Do setters/getters here provide any value? We kindof have to make the
fields in this class 'public' bc of how we use Jackson, and it doesn't look
like the getters/setters are doing anything that'd be different from users just
accessing the fields directly.
##########
solr/core/src/java/org/apache/solr/handler/admin/api/ReplicationAPIBase.java:
##########
@@ -73,22 +62,24 @@ protected CoreReplicationAPI.IndexVersionResponse
doFetchIndexVersion() throws I
return replicationHandler.getIndexVersionResponse();
}
- protected NamedList<Object> doFetchFiles(long generation) {
+ protected CoreReplicationAPI.FileListResponse doFetchFileList(long
generation) {
ReplicationHandler replicationHandler =
(ReplicationHandler)
solrCore.getRequestHandler(ReplicationHandler.PATH);
return getFileList(generation, replicationHandler);
}
- protected NamedList<Object> getFileList(long generation, ReplicationHandler
replicationHandler) {
+ protected CoreReplicationAPI.FileListResponse getFileList(
+ long generation, ReplicationHandler replicationHandler) {
final IndexDeletionPolicyWrapper delPol = solrCore.getDeletionPolicy();
- final NamedList<Object> filesResponse = new NamedList<>();
Review Comment:
[+1] Woohoo - always nice to see NamedList usages go away!
##########
solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java:
##########
@@ -764,12 +765,8 @@ public FileInfo(long lasmodified, String name, long size,
long checksum) {
this.checksum = checksum;
}
- Map<String, Object> getAsMap() {
- Map<String, Object> map = new HashMap<>();
- map.put(NAME, name);
- map.put(SIZE, size);
- map.put(CHECKSUM, checksum);
- return map;
+ CoreReplicationAPI.FileMetaData getAsMap() {
Review Comment:
[-1] We probably need to rename this method, since it's no longer returning
a map 😛
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]