【问题标题】:ContactPoints vs ContactPoint in Phantom-DSLPhantom-DSL 中的 ContactPoints 与 ContactPoint
【发布时间】:2018-02-22 01:15:57
【问题描述】:

为什么 Phantom-DSL 有 ContactPoints 和 ContactPoint 两种不同的连接器方式?

在使用 ContactPoint 时,我可以省略使用 host 或可以将 host 作为 String 但我必须声明端口在这里。

val default: CassandraConnection = ContactPoint(port).keySpace(keyspace)

但是在使用 ContactPoints 进行连接时,我必须将 host 声明为 Seq[String] 并且可以拥有或省略 port 在这里。

val default: CassandraConnection = ContactPoints(host).keySpace(keyspace)

除了我想的还有什么不同吗?

【问题讨论】:

    标签: scala cassandra phantom-dsl phantom-types


    【解决方案1】:

    实际使用情况取决于底层的 Cassandra 集群。如果你有一个 Cassandra 实例,那么 ContactPoint 就足够了。但是,更现实的情况是,当您有一个 3 节点 Cassandra 集群时,您可能希望通过 ContactPoints 分别声明每个实例的联系点。

    【讨论】:

      猜你喜欢
      • 2016-04-10
      • 1970-01-01
      • 1970-01-01
      • 2016-10-10
      • 2015-09-06
      • 1970-01-01
      • 2021-06-22
      • 2016-11-27
      • 1970-01-01
      相关资源
      最近更新 更多