Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* 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.solr.core.snapshots;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.solr.common.cloud.Replica;
import org.apache.solr.common.params.CoreAdminParams;
import org.apache.solr.common.util.NamedList;
import org.noggit.JSONWriter;
/** This class defines the meta-data about a collection level snapshot */
public class CollectionSnapshotMetaData implements JSONWriter.Writable {
public static class CoreSnapshotMetaData implements JSONWriter.Writable {
private final String coreName;
private final String indexDirPath;
private final long generationNumber;
private final boolean leader;
private final String shardId;
private final Collection files;
public CoreSnapshotMetaData(
String coreName,
String indexDirPath,
long generationNumber,
String shardId,
boolean leader,
Collection files) {
this.coreName = coreName;
this.indexDirPath = indexDirPath;
this.generationNumber = generationNumber;
this.shardId = shardId;
this.leader = leader;
this.files = files;
}
@SuppressWarnings({"unchecked"})
public CoreSnapshotMetaData(NamedList resp) {
this.coreName = (String) resp.get(CoreAdminParams.CORE);
this.indexDirPath = (String) resp.get(SolrSnapshotManager.INDEX_DIR_PATH);
this.generationNumber = (Long) resp.get(SolrSnapshotManager.GENERATION_NUM);
this.shardId = (String) resp.get(SolrSnapshotManager.SHARD_ID);
this.leader = (Boolean) resp.get(SolrSnapshotManager.LEADER);
this.files = (Collection) resp.get(SolrSnapshotManager.FILE_LIST);
}
public String getCoreName() {
return coreName;
}
public String getIndexDirPath() {
return indexDirPath;
}
public long getGenerationNumber() {
return generationNumber;
}
public Collection getFiles() {
return files;
}
public String getShardId() {
return shardId;
}
public boolean isLeader() {
return leader;
}
@Override
public void write(JSONWriter arg0) {
LinkedHashMap info = new LinkedHashMap<>();
info.put(CoreAdminParams.CORE, getCoreName());
info.put(SolrSnapshotManager.INDEX_DIR_PATH, getIndexDirPath());
info.put(SolrSnapshotManager.GENERATION_NUM, getGenerationNumber());
info.put(SolrSnapshotManager.SHARD_ID, getShardId());
info.put(SolrSnapshotManager.LEADER, isLeader());
info.put(SolrSnapshotManager.FILE_LIST, getFiles());
arg0.write(info);
}
public NamedList