org.elasticsearch.Version.min()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(9.5k)|赞(0)|评价(0)|浏览(80)

本文整理了Java中org.elasticsearch.Version.min()方法的一些代码示例,展示了Version.min()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version.min()方法的具体详情如下:
包路径:org.elasticsearch.Version
类名称:Version
方法名:min

Version.min介绍

[英]Returns the minimum version between the 2.
[中]返回2之间的最小版本。

代码示例

代码示例来源:origin: org.elasticsearch/elasticsearch

/**
 * Returns the minimum created index version that this version supports. Indices created with lower versions
 * can't be used with this version. This should also be used for file based serialization backwards compatibility ie. on serialization
 * code that is used to read / write file formats like transaction logs, cluster state, and index metadata.
 */
public Version minimumIndexCompatibilityVersion() {
  final int bwcMajor;
  if (major == 5) {
    bwcMajor = 2; // we jumped from 2 to 5
  } else {
    bwcMajor = major - 1;
  }
  final int bwcMinor = 0;
  return Version.min(this, fromId(bwcMajor * 1000000 + bwcMinor * 10000 + 99));
}

代码示例来源:origin: org.elasticsearch/elasticsearch

/**
 * Returns the minimum compatible version based on the current
 * version. Ie a node needs to have at least the return version in order
 * to communicate with a node running the current version. The returned version
 * is in most of the cases the smallest major version release unless the current version
 * is a beta or RC release then the version itself is returned.
 */
public Version minimumCompatibilityVersion() {
  if (major >= 6) {
    // all major versions from 6 onwards are compatible with last minor series of the previous major
    Version bwcVersion = null;
    for (int i = DeclaredVersionsHolder.DECLARED_VERSIONS.size() - 1; i >= 0; i--) {
      final Version candidateVersion = DeclaredVersionsHolder.DECLARED_VERSIONS.get(i);
      if (candidateVersion.major == major - 1 && candidateVersion.isRelease() && after(candidateVersion)) {
        if (bwcVersion != null && candidateVersion.minor < bwcVersion.minor) {
          break;
        }
        bwcVersion = candidateVersion;
      }
    }
    return bwcVersion == null ? this : bwcVersion;
  }
  return Version.min(this, fromId((int) major * 1000000 + 0 * 10000 + 99));
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

/**
 * Returns the minimum version between the 2.
 * @deprecated use {@link #min(Version, Version)} instead
 */
@Deprecated
public static Version smallest(Version version1, Version version2) {
  return min(version1, version2);
}

代码示例来源:origin: org.elasticsearch/elasticsearch

maxNonClientNodeVersion = version;
  } else {
    minNonClientNodeVersion = Version.min(minNonClientNodeVersion, version);
    maxNonClientNodeVersion = Version.max(maxNonClientNodeVersion, version);
  ingestNodesBuilder.put(nodeEntry.key, nodeEntry.value);
minNodeVersion = minNodeVersion == null ? version : Version.min(minNodeVersion, version);
maxNodeVersion = maxNodeVersion == null ? version : Version.max(maxNodeVersion, version);

代码示例来源:origin: org.elasticsearch/elasticsearch

final Version createdVersion = Version.min(Version.CURRENT, nodes.getSmallestNonClientNodeVersion());
indexSettingsBuilder.put(IndexMetaData.SETTING_INDEX_VERSION_CREATED.getKey(), createdVersion);

代码示例来源:origin: org.elasticsearch/elasticsearch

nodesBuilder.add(node);
  nodesChanged = true;
  minClusterNodeVersion = Version.min(minClusterNodeVersion, node.getVersion());
  maxClusterNodeVersion = Version.max(maxClusterNodeVersion, node.getVersion());
} catch (IllegalArgumentException | IllegalStateException e) {

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

/**
 * Returns the minimum created index version that this version supports. Indices created with lower versions
 * can't be used with this version. This should also be used for file based serialization backwards compatibility ie. on serialization
 * code that is used to read / write file formats like transaction logs, cluster state, and index metadata.
 */
public Version minimumIndexCompatibilityVersion() {
  final int bwcMajor;
  if (major == 5) {
    bwcMajor = 2; // we jumped from 2 to 5
  } else {
    bwcMajor = major - 1;
  }
  final int bwcMinor = 0;
  return Version.min(this, fromId(bwcMajor * 1000000 + bwcMinor * 10000 + 99));
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

/**
 * Returns the minimum created index version that this version supports. Indices created with lower versions
 * can't be used with this version.
 */
public Version minimumIndexCompatibilityVersion() {
  final int bwcMajor;
  if (major == 5) {
    bwcMajor = 2; // we jumped from 2 to 5
  } else {
    bwcMajor = major - 1;
  }
  final int bwcMinor;
  if (bwcMajor <= 2) {
    // we do support beta1 prior to 5.x
    // this allows clusters that have upgraded to 5.0 with an index created in 2.0.0.beta1 to go to 5.2 etc.
    // otherwise the upgrade will fail and that is really not what we want. from 5 onwards we are supporting only GA
    // releases
    bwcMinor = 01;
  } else {
    bwcMinor = 99;
  }
  return Version.min(this, fromId(bwcMajor * 1000000 + bwcMinor));
}

代码示例来源:origin: org.elasticsearch/elasticsearch

Version version = Version.min(this.version, channelVersion);

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

/**
 * Returns the minimum compatible version based on the current
 * version. Ie a node needs to have at least the return version in order
 * to communicate with a node running the current version. The returned version
 * is in most of the cases the smallest major version release unless the current version
 * is a beta or RC release then the version itself is returned.
 */
public Version minimumCompatibilityVersion() {
  final int bwcMajor;
  final int bwcMinor;
  if (major >= 6) {
    bwcMajor = major - 1;
    bwcMinor = CURRENT.minor;
  } else {
    bwcMajor = major;
    bwcMinor = 0;
  }
  return Version.min(this, fromId(bwcMajor * 1000000 + bwcMinor * 10000 + 99));
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

/**
 * Returns the minimum compatible version based on the current
 * version. Ie a node needs to have at least the return version in order
 * to communicate with a node running the current version. The returned version
 * is in most of the cases the smallest major version release unless the current version
 * is a beta or RC release then the version itself is returned.
 */
public Version minimumCompatibilityVersion() {
  if (major >= 6) {
    // all major versions from 6 onwards are compatible with last minor series of the previous major
    Version bwcVersion = null;
    for (int i = DeclaredVersionsHolder.DECLARED_VERSIONS.size() - 1; i >= 0; i--) {
      final Version candidateVersion = DeclaredVersionsHolder.DECLARED_VERSIONS.get(i);
      if (candidateVersion.major == major - 1 && candidateVersion.isRelease() && after(candidateVersion)) {
        if (bwcVersion != null && candidateVersion.minor < bwcVersion.minor) {
          break;
        }
        bwcVersion = candidateVersion;
      }
    }
    return bwcVersion == null ? this : bwcVersion;
  }
  return Version.min(this, fromId((int) major * 1000000 + 0 * 10000 + 99));
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

if (nodeEntry.value.isDataNode()) {
  dataNodesBuilder.put(nodeEntry.key, nodeEntry.value);
  minNonClientNodeVersion = Version.min(minNonClientNodeVersion, nodeEntry.value.getVersion());
  minNonClientNodeVersion = Version.min(minNonClientNodeVersion, nodeEntry.value.getVersion());
  minNonClientNodeVersion = Version.smallest(minNonClientNodeVersion, nodeEntry.value.getVersion());
minNodeVersion = Version.min(minNodeVersion, nodeEntry.value.getVersion());
maxNodeVersion = Version.max(maxNodeVersion, nodeEntry.value.getVersion());

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

minNodeVersion = Version.min(minNodeVersion, node.getVersion());
if (node.equals(BECOME_MASTER_TASK) || node.equals(FINISH_ELECTION_TASK)) {

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

maxNonClientNodeVersion = version;
  } else {
    minNonClientNodeVersion = Version.min(minNonClientNodeVersion, version);
    maxNonClientNodeVersion = Version.max(maxNonClientNodeVersion, version);
  ingestNodesBuilder.put(nodeEntry.key, nodeEntry.value);
minNodeVersion = minNodeVersion == null ? version : Version.min(minNodeVersion, version);
maxNodeVersion = maxNodeVersion == null ? version : Version.max(maxNodeVersion, version);

代码示例来源:origin: apache/servicemix-bundles

maxNonClientNodeVersion = version;
  } else {
    minNonClientNodeVersion = Version.min(minNonClientNodeVersion, version);
    maxNonClientNodeVersion = Version.max(maxNonClientNodeVersion, version);
  ingestNodesBuilder.put(nodeEntry.key, nodeEntry.value);
minNodeVersion = minNodeVersion == null ? version : Version.min(minNodeVersion, version);
maxNodeVersion = maxNodeVersion == null ? version : Version.max(maxNodeVersion, version);

代码示例来源:origin: apache/servicemix-bundles

nodesBuilder.add(node);
  nodesChanged = true;
  minClusterNodeVersion = Version.min(minClusterNodeVersion, node.getVersion());
  maxClusterNodeVersion = Version.max(maxClusterNodeVersion, node.getVersion());
} catch (IllegalArgumentException | IllegalStateException e) {

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

nodesBuilder.add(node);
  nodesChanged = true;
  minClusterNodeVersion = Version.min(minClusterNodeVersion, node.getVersion());
  maxClusterNodeVersion = Version.max(maxClusterNodeVersion, node.getVersion());
} catch (IllegalArgumentException | IllegalStateException e) {

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

protected void sendRequest(LocalTransport targetTransport, final DiscoveryNode node, final long requestId, final String action,
             final TransportRequest request,
    TransportRequestOptions options) throws IOException, TransportException {
  final Version version = Version.min(node.getVersion(), getVersion());
  try (BytesStreamOutput stream = new BytesStreamOutput()) {
    stream.setVersion(version);
    stream.writeLong(requestId);
    byte status = 0;
    status = TransportStatus.setRequest(status);
    stream.writeByte(status); // 0 for request, 1 for response.
    threadPool.getThreadContext().writeTo(stream);
    stream.writeString(action);
    request.writeTo(stream);
    stream.close();
    final byte[] data = BytesReference.toBytes(stream.bytes());
    transportServiceAdapter.addBytesSent(data.length);
    transportServiceAdapter.onRequestSent(node, requestId, action, request, options);
    targetTransport.receiveMessage(version, data, action, requestId, this);
  }
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

Version version = Version.min(getCurrentVersion(), channelVersion);

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

Version version = Version.min(getCurrentVersion(), channelVersion);

相关文章