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

Java ClockAndCount类代码示例

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

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



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

示例1: getClockAndCountOf

import org.apache.cassandra.db.ClockAndCount; //导入依赖的package包/类
/**
 * Returns the clock and the count associated with the given counter id, or (0, 0) if no such shard is present.
 */
@VisibleForTesting
public ClockAndCount getClockAndCountOf(ByteBuffer context, CounterId id)
{
    int position = findPositionOf(context, id);
    if (position == -1)
        return ClockAndCount.BLANK;

    long clock = context.getLong(position + CounterId.LENGTH);
    long count = context.getLong(position + CounterId.LENGTH + CLOCK_LENGTH);
    return ClockAndCount.create(clock, count);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:15,代码来源:CounterContext.java


示例2: testGetGlockAndCountOf

import org.apache.cassandra.db.ClockAndCount; //导入依赖的package包/类
@Test
public void testGetGlockAndCountOf()
{
    ContextState state = ContextState.allocate(3, 3, 3);

    state.writeGlobal(CounterId.fromInt(1), 1L, 1L);
    state.writeRemote(CounterId.fromInt(2), 2L, 2L);
    state.writeLocal( CounterId.fromInt(3), 3L, 3L);
    state.writeGlobal(CounterId.fromInt(4), 4L, 4L);
    state.writeRemote(CounterId.fromInt(5), 5L, 5L);
    state.writeLocal( CounterId.fromInt(6), 6L, 6L);
    state.writeGlobal(CounterId.fromInt(7), 7L, 7L);
    state.writeRemote(CounterId.fromInt(8), 8L, 8L);
    state.writeLocal(CounterId.fromInt(9), 9L, 9L);

    assertEquals(ClockAndCount.create(1L, 1L), cc.getClockAndCountOf(state.context, CounterId.fromInt(1)));
    assertEquals(ClockAndCount.create(2L, 2L), cc.getClockAndCountOf(state.context, CounterId.fromInt(2)));
    assertEquals(ClockAndCount.create(3L, 3L), cc.getClockAndCountOf(state.context, CounterId.fromInt(3)));
    assertEquals(ClockAndCount.create(4L, 4L), cc.getClockAndCountOf(state.context, CounterId.fromInt(4)));
    assertEquals(ClockAndCount.create(5L, 5L), cc.getClockAndCountOf(state.context, CounterId.fromInt(5)));
    assertEquals(ClockAndCount.create(6L, 6L), cc.getClockAndCountOf(state.context, CounterId.fromInt(6)));
    assertEquals(ClockAndCount.create(7L, 7L), cc.getClockAndCountOf(state.context, CounterId.fromInt(7)));
    assertEquals(ClockAndCount.create(8L, 8L), cc.getClockAndCountOf(state.context, CounterId.fromInt(8)));
    assertEquals(ClockAndCount.create(9L, 9L), cc.getClockAndCountOf(state.context, CounterId.fromInt(9)));

    assertEquals(ClockAndCount.create(0L, 0L), cc.getClockAndCountOf(state.context, CounterId.fromInt(0)));
    assertEquals(ClockAndCount.create(0L, 0L), cc.getClockAndCountOf(state.context, CounterId.fromInt(10)));
    assertEquals(ClockAndCount.create(0L, 0L), cc.getClockAndCountOf(state.context, CounterId.fromInt(15)));
    assertEquals(ClockAndCount.create(0L, 0L), cc.getClockAndCountOf(state.context, CounterId.fromInt(20)));
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:31,代码来源:CounterContextTest.java


示例3: getLocalClockAndCount

import org.apache.cassandra.db.ClockAndCount; //导入依赖的package包/类
/**
 * Returns the clock and the count associated with the local counter id, or (0, 0) if no such shard is present.
 */
public ClockAndCount getLocalClockAndCount(ByteBuffer context)
{
    return getClockAndCountOf(context, CounterId.getLocalId());
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:8,代码来源:CounterContext.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java Query类代码示例发布时间:2022-05-22
下一篇:
Java ImageDataDisk类代码示例发布时间: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