• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java HostAddress类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.facebook.presto.spi.HostAddress的典型用法代码示例。如果您正苦于以下问题:Java HostAddress类的具体用法?Java HostAddress怎么用?Java HostAddress使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



HostAddress类属于com.facebook.presto.spi包,在下文中一共展示了HostAddress类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: HDFSSplit

import com.facebook.presto.spi.HostAddress; //导入依赖的package包/类
@JsonCreator
public HDFSSplit(
        @JsonProperty("connectorId") HDFSConnectorId connectorId,
        @JsonProperty("table") SchemaTableName table,
        @JsonProperty("path") String path,
        @JsonProperty("start") long start,
        @JsonProperty("len") long len,
        @JsonProperty("addresses") List<HostAddress> addresses
        )
{
    this.connectorId = requireNonNull(connectorId, "connectorId is null");
    this.table = requireNonNull(table, "table is null");
    this.path = requireNonNull(path, "path is null");
    this.start = requireNonNull(start);
    this.len = requireNonNull(len);
    this.addresses = ImmutableList.copyOf(requireNonNull(addresses, "addresses is null"));
}
 
开发者ID:dbiir,项目名称:paraflow,代码行数:18,代码来源:HDFSSplit.java


示例2: getBlockLocations

import com.facebook.presto.spi.HostAddress; //导入依赖的package包/类
public List<HostAddress> getBlockLocations(Path file, long start, long len)
{
    Set<HostAddress> addresses = new HashSet<>();
    if (!getFS().isPresent()) {
        throw new FileSystemNotFoundException("");
    }
    BlockLocation[] locations = new BlockLocation[0];
    try {
        locations = getFS().get().getFileBlockLocations(file, start, len);
    }
    catch (IOException e) {
        log.error(e);
    }
    assert locations.length <= 1;
    for (BlockLocation location : locations) {
        try {
            addresses.addAll(toHostAddress(location.getHosts()));
        }
        catch (IOException e) {
            log.error(e);
        }
    }
    return new ArrayList<>(addresses);
}
 
开发者ID:dbiir,项目名称:paraflow,代码行数:25,代码来源:FSFactory.java


示例3: getSplits

import com.facebook.presto.spi.HostAddress; //导入依赖的package包/类
@Override
public ConnectorSplitSource getSplits(ConnectorTransactionHandle handle, ConnectorSession session, ConnectorTableLayoutHandle layout)
{
    log.info("INFORMATION: AmpoolSplitManager getSplits() called.");

    AmpoolTableLayoutHandle layoutHandle = (AmpoolTableLayoutHandle) layout;
    AmpoolTableHandle tableHandle = layoutHandle.getTable();
    AmpoolTable table = new AmpoolTable(ampoolClient, tableHandle.getTableName());
    // this can happen if table is removed during a query
    checkState(table.getColumnsMetadata() != null, "Table %s.%s no longer exists", tableHandle.getSchemaName(), tableHandle.getTableName());

    List<ConnectorSplit> splits = new ArrayList<>();
    // TODO Pass here bucket id
    splits.add(new AmpoolSplit(connectorId, tableHandle.getSchemaName(), tableHandle.getTableName(),"" ,HostAddress.fromParts("localhost",0)));
    Collections.shuffle(splits);

    return new FixedSplitSource(splits);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:19,代码来源:AmpoolSplitManager.java


示例4: getSplits

import com.facebook.presto.spi.HostAddress; //导入依赖的package包/类
@Override
    public ConnectorSplitSource getSplits(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorTableLayoutHandle layout)
    {
        KuduTableLayoutHandle layoutHandle = checkType(layout, KuduTableLayoutHandle.class, "layout");
        KuduTableHandle tableHandle = layoutHandle.getTable();
        KuduClient kuduClient = kuduClientManager.getClient();

        List<KuduScanToken> tokens = kuduClientManager.newScanTokenBuilder(kuduClient, tableHandle.getSchemaTableName().getTableName()).build();

        TupleDomain<KuduColumnHandle> effectivePredicate = layoutHandle.getConstraint()
                .transform(handle -> checkType(handle, KuduColumnHandle.class, "columnHandle"));

        ImmutableList.Builder<ConnectorSplit> builder = ImmutableList.builder();

        for (int i = 0; i < tokens.size(); i++) {
//            nodeManager.getWorkerNodes()
            List<HostAddress> hostAddresses = nodeManager.getWorkerNodes().stream()
                    .map(node -> node.getHostAndPort()).collect(Collectors.toList());
            ConnectorSplit split = new KuduSplit(hostAddresses, tableHandle.getSchemaTableName(), i, effectivePredicate);
            builder.add(split);
        }

        kuduClientManager.close(kuduClient);
        return new FixedSplitSource(builder.build());
    }
 
开发者ID:trackingio,项目名称:presto-kudu,代码行数:26,代码来源:KuduSplitManager.java


示例5: KafkaSplit

import com.facebook.presto.spi.HostAddress; //导入依赖的package包/类
@JsonCreator
public KafkaSplit(
        @JsonProperty("connectorId") String connectorId,
        @JsonProperty("topicName") String topicName,
        @JsonProperty("keyDataFormat") String keyDataFormat,
        @JsonProperty("messageDataFormat") String messageDataFormat,
        @JsonProperty("partitionId") int partitionId,
        @JsonProperty("start") long start,
        @JsonProperty("end") long end,
        @JsonProperty("nodes") List<HostAddress> nodes)
{
    this.connectorId = requireNonNull(connectorId, "connector id is null");
    this.topicName = requireNonNull(topicName, "topicName is null");
    this.keyDataFormat = requireNonNull(keyDataFormat, "dataFormat is null");
    this.messageDataFormat = requireNonNull(messageDataFormat, "messageDataFormat is null");
    this.partitionId = partitionId;
    this.start = start;
    this.end = end;
    this.nodes = ImmutableList.copyOf(requireNonNull(nodes, "addresses is null"));
}
 
开发者ID:y-lan,项目名称:presto,代码行数:21,代码来源:KafkaSplit.java


示例6: ExampleSplit

import com.facebook.presto.spi.HostAddress; //导入依赖的package包/类
@JsonCreator
    public ExampleSplit(
            @JsonProperty("connectorId") String connectorId,
            @JsonProperty("schemaName") String schemaName,
            @JsonProperty("tableName") String tableName,
            @JsonProperty("uri") URI uri)
    {
        this.schemaName = requireNonNull(schemaName, "schema name is null");
        this.connectorId = requireNonNull(connectorId, "connector id is null");
        this.tableName = requireNonNull(tableName, "table name is null");
        this.uri = requireNonNull(uri, "uri is null");

//        if ("http".equalsIgnoreCase(uri.getScheme()) || "https".equalsIgnoreCase(uri.getScheme())) {
        remotelyAccessible = true;
        addresses = ImmutableList.of(HostAddress.fromUri(uri));
    }
 
开发者ID:y-lan,项目名称:presto,代码行数:17,代码来源:ExampleSplit.java


示例7: testAddresses

import com.facebook.presto.spi.HostAddress; //导入依赖的package包/类
@Test
public void testAddresses()
{
    // http split with default port
    ExampleSplit httpSplit = new ExampleSplit("connectorId", "schemaName", "tableName", URI.create("http://example.com/example"));
    assertEquals(httpSplit.getAddresses(), ImmutableList.of(HostAddress.fromString("example.com")));
    assertEquals(httpSplit.isRemotelyAccessible(), true);

    // http split with custom port
    httpSplit = new ExampleSplit("connectorId", "schemaName", "tableName", URI.create("http://example.com:8080/example"));
    assertEquals(httpSplit.getAddresses(), ImmutableList.of(HostAddress.fromParts("example.com", 8080)));
    assertEquals(httpSplit.isRemotelyAccessible(), true);

    // http split with default port
    ExampleSplit httpsSplit = new ExampleSplit("connectorId", "schemaName", "tableName", URI.create("https://example.com/example"));
    assertEquals(httpsSplit.getAddresses(), ImmutableList.of(HostAddress.fromString("example.com")));
    assertEquals(httpsSplit.isRemotelyAccessible(), true);

    // http split with custom port
    httpsSplit = new ExampleSplit("connectorId", "schemaName", "tableName", URI.create("https://example.com:8443/example"));
    assertEquals(httpsSplit.getAddresses(), ImmutableList.of(HostAddress.fromParts("example.com", 8443)));
    assertEquals(httpsSplit.isRemotelyAccessible(), true);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:24,代码来源:TestExampleSplit.java


示例8: createSplit

import com.facebook.presto.spi.HostAddress; //导入依赖的package包/类
private ConnectorSplit createSplit(ShardNodes shard)
{
    UUID shardId = shard.getShardUuid();
    Collection<String> nodeIds = shard.getNodeIdentifiers();

    List<HostAddress> addresses = getAddressesForNodes(nodesById, nodeIds);

    if (addresses.isEmpty()) {
        if (!backupAvailable) {
            throw new PrestoException(RAPTOR_NO_HOST_FOR_SHARD, format("No host for shard %s found: %s", shardId, nodeIds));
        }

        // Pick a random node and optimistically assign the shard to it.
        // That node will restore the shard from the backup location.
        Set<Node> availableNodes = nodeSupplier.getWorkerNodes();
        if (availableNodes.isEmpty()) {
            throw new PrestoException(NO_NODES_AVAILABLE, "No nodes available to run query");
        }
        Node node = selectRandom(availableNodes);
        shardManager.assignShard(tableId, shardId, node.getNodeIdentifier());
        addresses = ImmutableList.of(node.getHostAndPort());
    }

    return new RaptorSplit(connectorId, shardId, addresses, effectivePredicate, transactionId);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:26,代码来源:RaptorSplitManager.java


示例9: RedisSplit

import com.facebook.presto.spi.HostAddress; //导入依赖的package包/类
@JsonCreator
public RedisSplit(
        @JsonProperty("connectorId") String connectorId,
        @JsonProperty("schemaName") String schemaName,
        @JsonProperty("tableName") String tableName,
        @JsonProperty("keyDataFormat") String keyDataFormat,
        @JsonProperty("valueDataFormat") String valueDataFormat,
        @JsonProperty("keyName") String keyName,
        @JsonProperty("start") long start,
        @JsonProperty("end") long end,
        @JsonProperty("nodes") List<HostAddress> nodes)
{
    this.connectorId = requireNonNull(connectorId, "connector id is null");
    this.schemaName = requireNonNull(schemaName, "schemaName is null");
    this.tableName = requireNonNull(tableName, "dataFormat is null");
    this.keyDataFormat = requireNonNull(keyDataFormat, "KeydataFormat is null");
    this.valueDataFormat = requireNonNull(valueDataFormat, "valueDataFormat is null");
    this.keyName = keyName;
    this.nodes = ImmutableList.copyOf(requireNonNull(nodes, "addresses is null"));
    this.start = start;
    this.end = end;
    this.valueDataType = toRedisDataType(valueDataFormat);
    this.keyDataType = toRedisDataType(keyDataFormat);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:25,代码来源:RedisSplit.java


示例10: testNoPredicate

import com.facebook.presto.spi.HostAddress; //导入依赖的package包/类
@Test
public void testNoPredicate()
        throws Exception
{
    ConnectorTableLayoutHandle layout = new JmxTableLayoutHandle(tableHandle, TupleDomain.all());
    ConnectorSplitSource splitSource = splitManager.getSplits(JmxTransactionHandle.INSTANCE, SESSION, layout);
    List<ConnectorSplit> allSplits = getAllSplits(splitSource);
    assertEquals(allSplits.size(), nodes.size());

    Set<String> actualNodes = nodes.stream().map(Node::getNodeIdentifier).collect(toSet());
    Set<String> expectedNodes = new HashSet<>();
    for (ConnectorSplit split : allSplits) {
        List<HostAddress> addresses = split.getAddresses();
        assertEquals(addresses.size(), 1);
        expectedNodes.add(addresses.get(0).getHostText());
    }
    assertEquals(actualNodes, expectedNodes);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:19,代码来源:TestJmxSplitManager.java


示例11: getSplits

import com.facebook.presto.spi.HostAddress; //导入依赖的package包/类
@Override
public ConnectorSplitSource getSplits(ConnectorTransactionHandle transaction, ConnectorSession session, ConnectorTableLayoutHandle layout)
{
    InformationSchemaTableLayoutHandle handle = checkType(layout, InformationSchemaTableLayoutHandle.class, "layout");
    Map<ColumnHandle, NullableValue> bindings = extractFixedValues(handle.getConstraint()).orElse(ImmutableMap.of());

    List<HostAddress> localAddress = ImmutableList.of(nodeManager.getCurrentNode().getHostAndPort());

    Map<String, NullableValue> filters = bindings.entrySet().stream().collect(toMap(
            entry -> checkType(entry.getKey(), InformationSchemaColumnHandle.class, "column").getColumnName(),
            Entry::getValue));

    ConnectorSplit split = new InformationSchemaSplit(handle.getTable(), filters, localAddress);

    return new FixedSplitSource(null, ImmutableList.of(split));
}
 
开发者ID:y-lan,项目名称:presto,代码行数:17,代码来源:InformationSchemaSplitManager.java


示例12: NetworkLocationCache

import com.facebook.presto.spi.HostAddress; //导入依赖的package包/类
public NetworkLocationCache(NetworkTopology networkTopology)
{
    this.networkTopology = requireNonNull(networkTopology, "networkTopology is null");

    this.cache = CacheBuilder.newBuilder()
            .expireAfterWrite(1, DAYS)
            .refreshAfterWrite(12, HOURS)
            .build(asyncReloading(new CacheLoader<HostAddress, NetworkLocation>()
            {
                @Override
                public NetworkLocation load(HostAddress host)
                        throws Exception
                {
                    return locate(host);
                }
            }, executor));

    this.negativeCache = CacheBuilder.newBuilder()
            .expireAfterWrite(NEGATIVE_CACHE_DURATION.toMillis(), MILLISECONDS)
            .build();
}
 
开发者ID:y-lan,项目名称:presto,代码行数:22,代码来源:NetworkLocationCache.java


示例13: testSerialization

import com.facebook.presto.spi.HostAddress; //导入依赖的package包/类
@Test
public void testSerialization()
        throws Exception
{
    String connectorId = "testid";
    SystemTableHandle tableHandle = new SystemTableHandle(connectorId, "xyz", "foo");
    SystemSplit expected = new SystemSplit(connectorId, tableHandle, HostAddress.fromParts("127.0.0.1", 0), TupleDomain.all());

    JsonCodec<SystemSplit> codec = jsonCodec(SystemSplit.class);
    SystemSplit actual = codec.fromJson(codec.toJson(expected));

    assertEquals(actual.getConnectorId(), expected.getConnectorId());
    assertEquals(actual.getTableHandle(), expected.getTableHandle());
    assertEquals(actual.getAddresses(), expected.getAddresses());
    assertEquals(actual.getConstraint(), expected.getConstraint());
}
 
开发者ID:y-lan,项目名称:presto,代码行数:17,代码来源:TestSystemSplit.java


示例14: CassandraSplit

import com.facebook.presto.spi.HostAddress; //导入依赖的package包/类
@JsonCreator
public CassandraSplit(
        @JsonProperty("connectorId") String connectorId,
        @JsonProperty("schema") String schema,
        @JsonProperty("table") String table,
        @JsonProperty("partitionId") String partitionId,
        @JsonProperty("splitCondition") String splitCondition,
        @JsonProperty("addresses") List<HostAddress> addresses)
{
    requireNonNull(connectorId, "connectorId is null");
    requireNonNull(schema, "schema is null");
    requireNonNull(table, "table is null");
    requireNonNull(partitionId, "partitionName is null");
    requireNonNull(addresses, "addresses is null");

    this.connectorId = connectorId;
    this.schema = schema;
    this.table = table;
    this.partitionId = partitionId;
    this.addresses = ImmutableList.copyOf(addresses);
    this.splitCondition = splitCondition;
}
 
开发者ID:y-lan,项目名称:presto,代码行数:23,代码来源:CassandraSplit.java


示例15: getSplitsByTokenRange

import com.facebook.presto.spi.HostAddress; //导入依赖的package包/类
private List<ConnectorSplit> getSplitsByTokenRange(CassandraTable table, String partitionId)
{
    String schema = table.getTableHandle().getSchemaName();
    String tableName = table.getTableHandle().getTableName();
    String tokenExpression = table.getTokenExpression();

    ImmutableList.Builder<ConnectorSplit> builder = ImmutableList.builder();
    List<CassandraTokenSplitManager.TokenSplit> tokenSplits;
    try {
        tokenSplits = tokenSplitMgr.getSplits(schema, tableName);
    }
    catch (IOException e) {
        throw new RuntimeException(e);
    }
    for (CassandraTokenSplitManager.TokenSplit tokenSplit : tokenSplits) {
        String condition = buildTokenCondition(tokenExpression, tokenSplit.getStartToken(), tokenSplit.getEndToken());
        List<HostAddress> addresses = new HostAddressFactory().AddressNamesToHostAddressList(tokenSplit.getHosts());
        CassandraSplit split = new CassandraSplit(connectorId, schema, tableName, partitionId, condition, addresses);
        builder.add(split);
    }

    return builder.build();
}
 
开发者ID:y-lan,项目名称:presto,代码行数:24,代码来源:CassandraSplitManager.java


示例16: testToHostAddressList

import com.facebook.presto.spi.HostAddress; //导入依赖的package包/类
@Test
public void testToHostAddressList()
        throws Exception
{
    Set<Host> hosts = ImmutableSet.<Host>of(
            new TestHost(
                new InetSocketAddress(
                    InetAddress.getByAddress(new byte[] {
                        1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
                    }),
                    3000)),
            new TestHost(new InetSocketAddress(InetAddress.getByAddress(new byte[] {1, 2, 3, 4}), 3000)));

    HostAddressFactory hostAddressFactory = new HostAddressFactory();
    List<HostAddress> list = hostAddressFactory.toHostAddressList(hosts);

    assertEquals(list.toString(), "[[102:304:506:708:90a:b0c:d0e:f10], 1.2.3.4]");
}
 
开发者ID:y-lan,项目名称:presto,代码行数:19,代码来源:TestHostAddressFactory.java


示例17: toHostAddress

import com.facebook.presto.spi.HostAddress; //导入依赖的package包/类
private List<HostAddress> toHostAddress(String[] hosts)
{
    ImmutableList.Builder<HostAddress> builder = ImmutableList.builder();
    for (String host : hosts) {
        builder.add(HostAddress.fromString(host));
    }
    return builder.build();
}
 
开发者ID:dbiir,项目名称:paraflow,代码行数:9,代码来源:FSFactory.java


示例18: RestConnectorSplit

import com.facebook.presto.spi.HostAddress; //导入依赖的package包/类
@JsonCreator
public RestConnectorSplit(
        @JsonProperty("tableHandle") RestTableHandle tableHandle,
        @JsonProperty("addresses") List<HostAddress> addresses)
{
    this.tableHandle = tableHandle;
    this.addresses = addresses;
}
 
开发者ID:prestodb-rocks,项目名称:presto-rest,代码行数:9,代码来源:RestConnectorSplit.java


示例19: getSplits

import com.facebook.presto.spi.HostAddress; //导入依赖的package包/类
@Override
public ConnectorSplitSource getSplits(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorTableLayoutHandle layout)
{
    RestConnectorTableLayoutHandle layoutHandle = Types.checkType(layout, RestConnectorTableLayoutHandle.class, "layout");

    List<HostAddress> addresses = nodeManager.getRequiredWorkerNodes().stream()
            .map(Node::getHostAndPort)
            .collect(toList());

    return new FixedSplitSource(ImmutableList.of(
            new RestConnectorSplit(layoutHandle.getTableHandle(), addresses)));
}
 
开发者ID:prestodb-rocks,项目名称:presto-rest,代码行数:13,代码来源:RestSplitManager.java


示例20: AmpoolSplit

import com.facebook.presto.spi.HostAddress; //导入依赖的package包/类
@JsonCreator
public AmpoolSplit(@JsonProperty("connectorId") String connectorId,
                   @JsonProperty("schemaName") String schemaName,
                   @JsonProperty("tableName") String tableName,
                   @JsonProperty("bucketId") String bucketId,
                   @JsonProperty("address") HostAddress address)
{
    this.schemaName = requireNonNull(schemaName, "schema name is null");
    this.connectorId = requireNonNull(connectorId, "connector id is null");
    this.tableName = requireNonNull(tableName, "table name is null");
    this.bucketId = requireNonNull(bucketId, "bucket id is null");
    this.address = requireNonNull(address, "address is null");
    log.info("INFORMATION: AmpoolSplit created successfully.");
}
 
开发者ID:ampool,项目名称:monarch,代码行数:15,代码来源:AmpoolSplit.java



注:本文中的com.facebook.presto.spi.HostAddress类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ContainerBrewingStand类代码示例发布时间:2022-05-22
下一篇:
Java EditLogValidation类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap