当前位置: 首页>>代码示例>>Java>>正文


Java BlobContainer.blobExists方法代码示例

本文整理汇总了Java中org.elasticsearch.common.blobstore.BlobContainer.blobExists方法的典型用法代码示例。如果您正苦于以下问题:Java BlobContainer.blobExists方法的具体用法?Java BlobContainer.blobExists怎么用?Java BlobContainer.blobExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.common.blobstore.BlobContainer的用法示例。


在下文中一共展示了BlobContainer.blobExists方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: verify

import org.elasticsearch.common.blobstore.BlobContainer; //导入方法依赖的package包/类
@Override
public void verify(String seed, DiscoveryNode localNode) {
    BlobContainer testBlobContainer = blobStore().blobContainer(basePath().add(testBlobPrefix(seed)));
    if (testBlobContainer.blobExists("master.dat")) {
        try  {
            BytesArray bytes = new BytesArray(seed);
            try (InputStream stream = bytes.streamInput()) {
                testBlobContainer.writeBlob("data-" + localNode.getId() + ".dat", stream, bytes.length());
            }
        } catch (IOException exp) {
            throw new RepositoryVerificationException(metadata.name(), "store location [" + blobStore() + "] is not accessible on the node [" + localNode + "]", exp);
        }
    } else {
        throw new RepositoryVerificationException(metadata.name(), "a file written by master to the store [" + blobStore() + "] cannot be accessed on the node [" + localNode + "]. "
            + "This might indicate that the store [" + blobStore() + "] is not shared between this node and the master node or "
            + "that permissions on the store don't allow reading files written by the master node");
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:19,代码来源:BlobStoreRepository.java

示例2: verify

import org.elasticsearch.common.blobstore.BlobContainer; //导入方法依赖的package包/类
@Override
public void verify(String seed) {
    BlobContainer testBlobContainer = blobStore.blobContainer(basePath.add(testBlobPrefix(seed)));
    DiscoveryNode localNode = clusterService.localNode();
    if (testBlobContainer.blobExists("master.dat")) {
        try  {
            testBlobContainer.writeBlob("data-" + localNode.getId() + ".dat", new BytesArray(seed));
        } catch (IOException exp) {
            throw new RepositoryVerificationException(repositoryName, "store location [" + blobStore + "] is not accessible on the node [" + localNode + "]", exp);
        }
    } else {
        throw new RepositoryVerificationException(repositoryName, "a file written by master to the store [" + blobStore + "] cannot be accessed on the node [" + localNode + "]. "
                + "This might indicate that the store [" + blobStore + "] is not shared between this node and the master node or "
                + "that permissions on the store don't allow reading files written by the master node");
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:17,代码来源:BlobStoreIndexShardRepository.java

示例3: exists

import org.elasticsearch.common.blobstore.BlobContainer; //导入方法依赖的package包/类
/**
 * Checks obj in the blob container
 */
public boolean exists(BlobContainer blobContainer, String name) throws IOException {
    return blobContainer.blobExists(blobName(name));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:7,代码来源:BlobStoreFormat.java


注:本文中的org.elasticsearch.common.blobstore.BlobContainer.blobExists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。