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


Java TimeUUIDType类代码示例

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


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

示例1: testEmptiableTypes

import org.apache.cassandra.db.marshal.TimeUUIDType; //导入依赖的package包/类
@Test
public void testEmptiableTypes()
{
    AbstractType<?>[] types = new AbstractType<?>[]{
                                                   BooleanType.instance,
                                                   CounterColumnType.instance,
                                                   DateType.instance,
                                                   DecimalType.instance,
                                                   DoubleType.instance,
                                                   FloatType.instance,
                                                   InetAddressType.instance,
                                                   Int32Type.instance,
                                                   IntegerType.instance,
                                                   LongType.instance,
                                                   TimestampType.instance,
                                                   TimeUUIDType.instance,
                                                   UUIDType.instance
    };

    for (AbstractType<?> type : types)
    {
        Assert.assertTrue(type.getClass().getSimpleName(), UDHelper.isNullOrEmpty(type, ByteBufferUtil.EMPTY_BYTE_BUFFER));
        Assert.assertTrue("reversed " + type.getClass().getSimpleName(),
                          UDHelper.isNullOrEmpty(ReversedType.getInstance(type), ByteBufferUtil.EMPTY_BYTE_BUFFER));
    }
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:27,代码来源:UDHelperTest.java

示例2: testTimeUuidType

import org.apache.cassandra.db.marshal.TimeUUIDType; //导入依赖的package包/类
@Test
public void testTimeUuidType()
{
    System.out.println("testTimeUuidType");
    final AbstractType<UUID> type = TimeUUIDType.instance;
    Reducer<ByteBuffer, Counted<ByteBuffer>> reducer = new Counter<ByteBuffer>();

    List<List<ByteBuffer>> lists = new SimpleListGenerator<ByteBuffer>(type, ITERATOR_COUNT, LIST_LENGTH) {
        @Override
        public ByteBuffer next()
        {
            return type.decompose(UUIDGen.getTimeUUID());
        }
    }.result;
    testMergeIterator(reducer, lists, type);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:17,代码来源:MergeIteratorComparisonTest.java

示例3: testValidatorClassToKind

import org.apache.cassandra.db.marshal.TimeUUIDType; //导入依赖的package包/类
public void testValidatorClassToKind() {
    assertEquals(Kind.validatorClassToKind(null), Kind.NOT_A_COLLECTION);
    assertEquals(Kind.validatorClassToKind(TimeUUIDType.class), Kind.NOT_A_COLLECTION);
    assertEquals(Kind.validatorClassToKind(UTF8Type.class), Kind.NOT_A_COLLECTION);
    assertEquals(Kind.validatorClassToKind(Int32Type.class), Kind.NOT_A_COLLECTION);

    assertEquals(Kind.validatorClassToKind(BooleanType.class), Kind.NOT_A_COLLECTION);
    assertEquals(Kind.validatorClassToKind(TimestampType.class), Kind.NOT_A_COLLECTION);
    assertEquals(Kind.validatorClassToKind(DecimalType.class), Kind.NOT_A_COLLECTION);
    assertEquals(Kind.validatorClassToKind(LongType.class), Kind.NOT_A_COLLECTION);
    assertEquals(Kind.validatorClassToKind(DoubleType.class), Kind.NOT_A_COLLECTION);

    assertEquals(Kind.validatorClassToKind(FloatType.class), Kind.NOT_A_COLLECTION);
    assertEquals(Kind.validatorClassToKind(InetAddressType.class), Kind.NOT_A_COLLECTION);
    assertEquals(Kind.validatorClassToKind(IntegerType.class), Kind.NOT_A_COLLECTION);
    assertEquals(Kind.validatorClassToKind(UUIDType.class), Kind.NOT_A_COLLECTION);

    assertEquals(Kind.validatorClassToKind(SetType.class), Kind.SET);
    assertEquals(Kind.validatorClassToKind(ListType.class), Kind.LIST);
    assertEquals(Kind.validatorClassToKind(MapType.class), Kind.MAP);
}
 
开发者ID:Stratio,项目名称:deep-spark,代码行数:22,代码来源:CellValidatorTest.java

示例4: generateColumns

import org.apache.cassandra.db.marshal.TimeUUIDType; //导入依赖的package包/类
protected List<Column> generateColumns()
{
    final List<ByteBuffer> values = generateColumnValues();
    final List<Column> columns = new ArrayList<>(values.size());

    if (state.settings.columns.useTimeUUIDComparator)
        for (int i = 0 ; i < values.size() ; i++)
            new Column(TimeUUIDType.instance.decompose(UUIDGen.getTimeUUID()));
    else
        // TODO : consider randomly allocating column names in case where have fewer than max columns
        // but need to think about implications for indexes / indexed range slicer / other knock on effects
        for (int i = 0 ; i < values.size() ; i++)
            columns.add(new Column(getColumnNameBytes(i)));

    for (int i = 0 ; i < values.size() ; i++)
        columns.get(i)
                .setValue(values.get(i))
                .setTimestamp(FBUtilities.timestampMicros());

    return columns;
}
 
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:22,代码来源:ThriftInserter.java

示例5: generateColumns

import org.apache.cassandra.db.marshal.TimeUUIDType; //导入依赖的package包/类
protected List<Column> generateColumns(ByteBuffer key)
{
    final List<ByteBuffer> values = generateColumnValues(key);
    final List<Column> columns = new ArrayList<>(values.size());

    if (state.settings.columns.useTimeUUIDComparator)
        for (int i = 0 ; i < values.size() ; i++)
            new Column(TimeUUIDType.instance.decompose(UUIDGen.getTimeUUID()));
    else
        // TODO : consider randomly allocating column names in case where have fewer than max columns
        // but need to think about implications for indexes / indexed range slicer / other knock on effects
        for (int i = 0 ; i < values.size() ; i++)
            columns.add(new Column(state.settings.columns.names.get(i)));

    for (int i = 0 ; i < values.size() ; i++)
        columns.get(i)
                .setValue(values.get(i))
                .setTimestamp(FBUtilities.timestampMicros());

    return columns;
}
 
开发者ID:rajath26,项目名称:cassandra-trunk,代码行数:22,代码来源:ThriftInserter.java

示例6: rectify

import org.apache.cassandra.db.marshal.TimeUUIDType; //导入依赖的package包/类
/** 
 * will either push or pull an updating depending on who is behind.
 * fat clients should never push their schemas (since they have no local storage).
 */
public static void rectify(UUID theirVersion, InetAddress endpoint)
{
    UUID myVersion = DatabaseDescriptor.getDefsVersion();
    if (theirVersion.timestamp() < myVersion.timestamp()
        && !StorageService.instance.isClientMode())
    {
        if (lastPushed.get(endpoint) == null || theirVersion.timestamp() >= lastPushed.get(endpoint).timestamp())
        {
            logger.debug("Schema on {} is old. Sending updates since {}", endpoint, theirVersion);
            Collection<IColumn> migrations = Migration.getLocalMigrations(theirVersion, myVersion);
            pushMigrations(endpoint, migrations);
            lastPushed.put(endpoint, TimeUUIDType.instance.compose(Iterables.getLast(migrations).name()));
        }
        else
        {
            logger.debug("Waiting for {} to process migrations up to {} before sending more",
                         endpoint, lastPushed.get(endpoint));
        }
    }
}
 
开发者ID:devdattakulkarni,项目名称:Cassandra-KVPM,代码行数:25,代码来源:MigrationManager.java

示例7: timeUUIDComparison

import org.apache.cassandra.db.marshal.TimeUUIDType; //导入依赖的package包/类
@Test
public void timeUUIDComparison() {
    TimeUUIDType ti = TimeUUIDType.instance;

    UUID zu = UUID.fromString(z);
    UUID vu = UUID.fromString(v);

    ByteBuffer zb = ti.decompose(zu);
    ByteBuffer vb = ti.decompose(vu);

    assertEquals(-1, ti.compare(zb, vb));
    assertEquals(1, zu.compareTo(vu));
    assertEquals(1, ti.compare(vb, zb));
    assertEquals(-1, vu.compareTo(zu));
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:16,代码来源:UUIDTest.java

示例8: testMinTimeUuid

import org.apache.cassandra.db.marshal.TimeUUIDType; //导入依赖的package包/类
@Test
public void testMinTimeUuid()
{
    DateTime dateTime = DateTimeFormat.forPattern("yyyy-MM-dd hh:mm:ss")
            .withZone(DateTimeZone.UTC)
            .parseDateTime("2015-05-21 11:03:02");

    long timeInMillis = dateTime.getMillis();
    ByteBuffer input = TimestampType.instance.fromString("2015-05-21 11:03:02+00");
    ByteBuffer output = executeFunction(TimeFcts.minTimeuuidFct, input);
    assertEquals(UUIDGen.minTimeUUID(timeInMillis), TimeUUIDType.instance.compose(output));
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:13,代码来源:TimeFctsTest.java

示例9: testMaxTimeUuid

import org.apache.cassandra.db.marshal.TimeUUIDType; //导入依赖的package包/类
@Test
public void testMaxTimeUuid()
{
    DateTime dateTime = DateTimeFormat.forPattern("yyyy-MM-dd hh:mm:ss")
            .withZone(DateTimeZone.UTC)
            .parseDateTime("2015-05-21 11:03:02");

    long timeInMillis = dateTime.getMillis();
    ByteBuffer input = TimestampType.instance.fromString("2015-05-21 11:03:02+00");
    ByteBuffer output = executeFunction(TimeFcts.maxTimeuuidFct, input);
    assertEquals(UUIDGen.maxTimeUUID(timeInMillis), TimeUUIDType.instance.compose(output));
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:13,代码来源:TimeFctsTest.java

示例10: testSortTimeUUIDsAsNative

import org.apache.cassandra.db.marshal.TimeUUIDType; //导入依赖的package包/类
@Test
public void testSortTimeUUIDsAsNative() {
    List<UUID> uuids = toList("24f340bc-89da-11e4-b116-123b93f75cba",
                              "24f34328-89da-11e4-b116-123b93f75cba",
                              "24f34486-89da-11e4-b116-123b93f75cba",
                              "24f3465c-89da-11e4-b116-123b93f75cba",
                              "24f3481e-89da-11e4-b116-123b93f75cba",
                              "24f3481e-89da-11e4-b116-123b93f75cba",
                              "24f3495e-89da-11e4-b116-123b93f75cba",
                              "24f34a8a-89da-11e4-b116-123b93f75cba",
                              "24f34bb6-89da-11e4-b116-123b93f75cba",
                              "24f34ce2-89da-11e4-b116-123b93f75cba",
                              "24f34e0e-89da-11e4-b116-123b93f75cba");
    testSort(uuids, TimeUUIDType.instance);
}
 
开发者ID:Stratio,项目名称:stratio-cassandra,代码行数:16,代码来源:ColumnMapperUUIDTest.java

示例11: trace_next_query

import org.apache.cassandra.db.marshal.TimeUUIDType; //导入依赖的package包/类
public ByteBuffer trace_next_query() throws TException
{
    UUID sessionId = UUIDGen.getTimeUUID();
    state().getQueryState().prepareTracingSession(sessionId);
    return TimeUUIDType.instance.decompose(sessionId);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:7,代码来源:CassandraServer.java

示例12: newSession

import org.apache.cassandra.db.marshal.TimeUUIDType; //导入依赖的package包/类
public UUID newSession()
{
    return newSession(TimeUUIDType.instance.compose(ByteBuffer.wrap(UUIDGen.getTimeUUIDBytes())));
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:5,代码来源:Tracing.java

示例13: TimeUUIDs

import org.apache.cassandra.db.marshal.TimeUUIDType; //导入依赖的package包/类
public TimeUUIDs(String name, GeneratorConfig config)
{
    super(TimeUUIDType.instance, config, name, UUID.class);
    dateGen = new Dates(name, config);
    clockSeqAndNode = config.salt;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:7,代码来源:TimeUUIDs.java

示例14: cqlTableTest

import org.apache.cassandra.db.marshal.TimeUUIDType; //导入依赖的package包/类
private void cqlTableTest(String initialQuery) throws IOException
{
    pig.registerQuery(initialQuery);
    Iterator<Tuple> it = pig.openIterator("rows");
    //{key: int, 
    //col_ascii: chararray, 
    //col_bigint: long, 
    //col_blob: bytearray, 
    //col_boolean: bytearray,
    //col_decimal: chararray, 
    //col_double: double, 
    //col_float: float, 
    //col_inet: chararray, 
    //col_int: int,
    //col_text: chararray, 
    //col_timestamp: long, 
    //col_timeuuid: bytearray, 
    //col_uuid: chararray,
    //col_varchar: chararray, 
    //col_varint: int}
    if (it.hasNext()) {
        Tuple t = it.next();
        Assert.assertEquals(t.get(0), 1);
        Assert.assertEquals(t.get(1), "ascii");
        Assert.assertEquals(t.get(2), 12345678L);
        Assert.assertEquals(t.get(3), new DataByteArray(Hex.hexToBytes("23446c6c6f")));
        Assert.assertEquals(t.get(4), false);
        Assert.assertEquals(t.get(5), "23.4567");
        Assert.assertEquals(t.get(6), 12345678.12345678d);
        Assert.assertEquals(t.get(7), 123.12f);
        Assert.assertEquals(t.get(8), "127.0.0.1");
        Assert.assertEquals(t.get(9), 123);
        Assert.assertEquals(t.get(10), "text");
        Assert.assertEquals(t.get(11), 1296705900000L);
        Assert.assertEquals(t.get(12), new DataByteArray((TimeUUIDType.instance.fromString("e23f450f-53a6-11e2-7f7f-7f7f7f7f7f7f").array())));
        Assert.assertEquals(t.get(13), new DataByteArray((UUIDType.instance.fromString("550e8400-e29b-41d4-a716-446655440000").array())));
        Assert.assertEquals(t.get(14), "varchar");
        Assert.assertEquals(t.get(15), 123);
    }
    else
    {
        Assert.fail("Failed to get data for query " + initialQuery);
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:45,代码来源:CqlTableDataTypeTest.java

示例15: columnName

import org.apache.cassandra.db.marshal.TimeUUIDType; //导入依赖的package包/类
protected ByteBuffer columnName(int index, boolean timeUUIDComparator)
{
    return timeUUIDComparator
            ? TimeUUIDType.instance.decompose(UUIDGen.getTimeUUID())
            : ByteBufferUtil.bytes(String.format("C%d", index));
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:7,代码来源:Operation.java


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