本文整理汇总了Java中org.apache.cassandra.db.marshal.UUIDType类的典型用法代码示例。如果您正苦于以下问题:Java UUIDType类的具体用法?Java UUIDType怎么用?Java UUIDType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UUIDType类属于org.apache.cassandra.db.marshal包,在下文中一共展示了UUIDType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: asyncRemoveFromBatchlog
import org.apache.cassandra.db.marshal.UUIDType; //导入依赖的package包/类
private static void asyncRemoveFromBatchlog(Collection<InetAddress> endpoints, UUID uuid)
{
AbstractWriteResponseHandler handler = new WriteResponseHandler(endpoints,
Collections.<InetAddress>emptyList(),
ConsistencyLevel.ANY,
Keyspace.open(Keyspace.SYSTEM_KS),
null,
WriteType.SIMPLE);
Mutation mutation = new Mutation(Keyspace.SYSTEM_KS, UUIDType.instance.decompose(uuid));
mutation.delete(SystemKeyspace.BATCHLOG_CF, FBUtilities.timestampMicros());
MessageOut<Mutation> message = mutation.createMessage();
for (InetAddress target : endpoints)
{
if (target.equals(FBUtilities.getBroadcastAddress()) && OPTIMIZE_LOCAL_REQUESTS)
insertLocal(message.payload, handler);
else
MessagingService.instance().sendRR(message, target, handler, false);
}
}
示例2: createLegacyHint
import org.apache.cassandra.db.marshal.UUIDType; //导入依赖的package包/类
private static Mutation createLegacyHint(Mutation mutation, long now, UUID targetId)
{
int version = MessagingService.VERSION_21;
int ttl = mutation.smallestGCGS();
UUID hintId = UUIDGen.getTimeUUID();
ByteBuffer key = UUIDType.instance.decompose(targetId);
Clustering clustering = SystemKeyspace.LegacyHints.comparator.make(hintId, version);
ByteBuffer value = ByteBuffer.wrap(FBUtilities.serialize(mutation, Mutation.serializer, version));
Cell cell = BufferCell.expiring(SystemKeyspace.LegacyHints.compactValueColumn(),
now,
ttl,
FBUtilities.nowInSeconds(),
value);
return new Mutation(PartitionUpdate.singleRowUpdate(SystemKeyspace.LegacyHints,
key,
BTreeRow.singleCellRow(clustering, cell)));
}
示例3: testEmptiableTypes
import org.apache.cassandra.db.marshal.UUIDType; //导入依赖的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));
}
}
示例4: testUuidType
import org.apache.cassandra.db.marshal.UUIDType; //导入依赖的package包/类
@Test
public void testUuidType()
{
System.out.println("testUuidType");
final AbstractType<UUID> type = UUIDType.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);
}
示例5: defineSchema
import org.apache.cassandra.db.marshal.UUIDType; //导入依赖的package包/类
@BeforeClass
public static void defineSchema() throws ConfigurationException
{
SchemaLoader.loadSchema();
SchemaLoader.createKeyspace(KEYSPACE,
KeyspaceParams.simple(1),
SchemaLoader.standardCFMD(KEYSPACE, CF),
SchemaLoader.standardCFMD(KEYSPACE, CF2),
SchemaLoader.standardCFMD(KEYSPACE, CF3),
SchemaLoader.counterCFMD(KEYSPACE, COUNTER_CF)
.compression(SchemaLoader.getCompressionParameters(COMPRESSION_CHUNK_LENGTH)),
SchemaLoader.standardCFMD(KEYSPACE, CF_UUID, 0, UUIDType.instance),
SchemaLoader.keysIndexCFMD(KEYSPACE, CF_INDEX1, true),
SchemaLoader.compositeIndexCFMD(KEYSPACE, CF_INDEX2, true),
SchemaLoader.keysIndexCFMD(KEYSPACE, CF_INDEX1_BYTEORDERED, true).copy(ByteOrderedPartitioner.instance),
SchemaLoader.compositeIndexCFMD(KEYSPACE, CF_INDEX2_BYTEORDERED, true).copy(ByteOrderedPartitioner.instance));
}
示例6: defineSchema
import org.apache.cassandra.db.marshal.UUIDType; //导入依赖的package包/类
@BeforeClass
public static void defineSchema() throws ConfigurationException
{
CompressionParams compressionParameters = CompressionParams.snappy(32768);
SchemaLoader.loadSchema();
SchemaLoader.createKeyspace(KEYSPACE,
KeyspaceParams.simple(1),
SchemaLoader.standardCFMD(KEYSPACE, CF).compression(compressionParameters),
SchemaLoader.standardCFMD(KEYSPACE, CF2).compression(compressionParameters),
SchemaLoader.standardCFMD(KEYSPACE, CF3),
SchemaLoader.standardCFMD(KEYSPACE, CF4),
SchemaLoader.standardCFMD(KEYSPACE, CORRUPT_CF),
SchemaLoader.standardCFMD(KEYSPACE, CORRUPT_CF2),
SchemaLoader.counterCFMD(KEYSPACE, COUNTER_CF).compression(compressionParameters),
SchemaLoader.counterCFMD(KEYSPACE, COUNTER_CF2).compression(compressionParameters),
SchemaLoader.counterCFMD(KEYSPACE, COUNTER_CF3),
SchemaLoader.counterCFMD(KEYSPACE, COUNTER_CF4),
SchemaLoader.counterCFMD(KEYSPACE, CORRUPTCOUNTER_CF),
SchemaLoader.counterCFMD(KEYSPACE, CORRUPTCOUNTER_CF2),
SchemaLoader.standardCFMD(KEYSPACE, CF_UUID, 0, UUIDType.instance));
}
示例7: testValidatorClassToKind
import org.apache.cassandra.db.marshal.UUIDType; //导入依赖的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);
}
示例8: testSortMixedUUIDs
import org.apache.cassandra.db.marshal.UUIDType; //导入依赖的package包/类
@Test
public void testSortMixedUUIDs() {
List<UUID> uuids = toList("520fdc7d-8d62-4c46-a22c-1f6c481f032f",
"6a5a5f84-0482-408e-9600-6b7fafaaa9cb",
"ece1ff82-c92c-4179-9e7f-0d6349810472",
"6c211cca-fbf3-4777-b359-85440e10b1fa",
"33b51b24-a2fe-4713-b881-d53acc970758",
"33b51b24-a2fe-4713-b881-d53acc970758",
"a156804e-7ec1-496a-af77-80b8576d6cda",
"0c9510f1-b3de-404d-a38e-e6d73b5bd566",
"cea36e37-de23-4875-912d-be1da52eef33",
"055b32ee-8b26-4dc1-8e4f-70580f855349",
"675b03f0-74bb-49b6-877f-562b6f306bea",
"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, UUIDType.instance);
}
示例9: asyncRemoveFromBatchlog
import org.apache.cassandra.db.marshal.UUIDType; //导入依赖的package包/类
private static void asyncRemoveFromBatchlog(Collection<InetAddress> endpoints, UUID uuid)
{
AbstractWriteResponseHandler handler = new WriteResponseHandler(endpoints,
Collections.<InetAddress>emptyList(),
ConsistencyLevel.ANY,
Keyspace.open(Keyspace.SYSTEM_KS),
null,
WriteType.SIMPLE);
Mutation mutation = new Mutation(Keyspace.SYSTEM_KS, UUIDType.instance.decompose(uuid));
mutation.delete(SystemKeyspace.BATCHLOG_CF, FBUtilities.timestampMicros());
MessageOut<Mutation> message = mutation.createMessage();
for (InetAddress target : endpoints)
{
if (target.equals(FBUtilities.getBroadcastAddress()) && OPTIMIZE_LOCAL_REQUESTS)
insertLocal(message.payload, handler);
else
MessagingService.instance().sendRR(message, target, handler);
}
}
示例10: getBatchlogMutationFor
import org.apache.cassandra.db.marshal.UUIDType; //导入依赖的package包/类
@VisibleForTesting
static Mutation getBatchlogMutationFor(Collection<Mutation> mutations, UUID uuid, int version, long now)
{
ColumnFamily cf = ArrayBackedSortedColumns.factory.create(CFMetaData.BatchlogCf);
CFRowAdder adder = new CFRowAdder(cf, CFMetaData.BatchlogCf.comparator.builder().build(), now);
adder.add("data", serializeMutations(mutations, version))
.add("written_at", new Date(now / 1000))
.add("version", version);
return new Mutation(Keyspace.SYSTEM_KS, UUIDType.instance.decompose(uuid), cf);
}
示例11: testHintsMetrics
import org.apache.cassandra.db.marshal.UUIDType; //导入依赖的package包/类
@Test
public void testHintsMetrics() throws Exception
{
for (int i = 0; i < 99; i++)
HintedHandOffManager.instance.metrics.incrPastWindow(InetAddress.getLocalHost());
HintedHandOffManager.instance.metrics.log();
UntypedResultSet rows = executeInternal("SELECT hints_dropped FROM system." + SystemKeyspace.PEER_EVENTS_CF);
Map<UUID, Integer> returned = rows.one().getMap("hints_dropped", UUIDType.instance, Int32Type.instance);
assertEquals(Iterators.getLast(returned.values().iterator()).intValue(), 99);
}
示例12: asyncRemoveFromBatchlog
import org.apache.cassandra.db.marshal.UUIDType; //导入依赖的package包/类
private static void asyncRemoveFromBatchlog(Collection<InetAddress> endpoints, UUID uuid)
{
ColumnFamily cf = EmptyColumns.factory.create(Schema.instance.getCFMetaData(Keyspace.SYSTEM_KS, SystemKeyspace.BATCHLOG_CF));
cf.delete(new DeletionInfo(FBUtilities.timestampMicros(), (int) (System.currentTimeMillis() / 1000)));
AbstractWriteResponseHandler handler = new WriteResponseHandler(endpoints,
Collections.<InetAddress>emptyList(),
ConsistencyLevel.ANY,
Keyspace.open(Keyspace.SYSTEM_KS),
null,
WriteType.SIMPLE);
RowMutation rm = new RowMutation(Keyspace.SYSTEM_KS, UUIDType.instance.decompose(uuid), cf);
updateBatchlog(rm, endpoints, handler);
}
示例13: getBatchlogMutationFor
import org.apache.cassandra.db.marshal.UUIDType; //导入依赖的package包/类
public static RowMutation getBatchlogMutationFor(Collection<RowMutation> mutations, UUID uuid)
{
long timestamp = FBUtilities.timestampMicros();
ByteBuffer writtenAt = LongType.instance.decompose(timestamp / 1000);
ByteBuffer data = serializeRowMutations(mutations);
ColumnFamily cf = ArrayBackedSortedColumns.factory.create(CFMetaData.BatchlogCf);
cf.addColumn(new Column(columnName(""), ByteBufferUtil.EMPTY_BYTE_BUFFER, timestamp));
cf.addColumn(new Column(columnName("data"), data, timestamp));
cf.addColumn(new Column(columnName("written_at"), writtenAt, timestamp));
return new RowMutation(Keyspace.SYSTEM_KS, UUIDType.instance.decompose(uuid), cf);
}
示例14: testHintsMetrics
import org.apache.cassandra.db.marshal.UUIDType; //导入依赖的package包/类
@Test
public void testHintsMetrics() throws Exception
{
for (int i = 0; i < 99; i++)
HintedHandOffManager.instance.metrics.incrPastWindow(InetAddress.getLocalHost());
HintedHandOffManager.instance.metrics.log();
UntypedResultSet rows = processInternal("SELECT hints_dropped FROM system." + SystemKeyspace.PEER_EVENTS_CF);
Map<UUID, Integer> returned = rows.one().getMap("hints_dropped", UUIDType.instance, Int32Type.instance);
assertEquals(Iterators.getLast(returned.values().iterator()).intValue(), 99);
}
示例15: deleteLegacyHintsPartition
import org.apache.cassandra.db.marshal.UUIDType; //导入依赖的package包/类
private static void deleteLegacyHintsPartition(UUID hostId)
{
// intentionally use millis, like the rest of the legacy implementation did, just in case
Mutation mutation = new Mutation(PartitionUpdate.fullPartitionDelete(SystemKeyspace.LegacyHints,
UUIDType.instance.decompose(hostId),
System.currentTimeMillis(),
FBUtilities.nowInSeconds()));
mutation.applyUnsafe();
}