本文整理汇总了Java中org.apache.cassandra.db.composites.CellName类的典型用法代码示例。如果您正苦于以下问题:Java CellName类的具体用法?Java CellName怎么用?Java CellName使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CellName类属于org.apache.cassandra.db.composites包,在下文中一共展示了CellName类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: validateColumn
import org.apache.cassandra.db.composites.CellName; //导入依赖的package包/类
public static void validateColumn(CFMetaData metadata, CellName name, ByteBuffer value)
throws InvalidRequestException
{
validateColumnName(name);
AbstractType<?> validator = metadata.getValueValidator(name);
try
{
if (validator != null)
validator.validate(value);
}
catch (MarshalException me)
{
throw new InvalidRequestException(String.format("Invalid column value for column (name=%s); %s",
ByteBufferUtil.bytesToHex(name.toByteBuffer()),
me.getMessage()));
}
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:19,代码来源:QueryProcessor.java
示例2: mutationForKey
import org.apache.cassandra.db.composites.CellName; //导入依赖的package包/类
public Mutation mutationForKey(ByteBuffer key, String keyspace, Long timestamp, ThriftClientState clientState, List<ByteBuffer> variables, CFMetaData metadata)
throws InvalidRequestException
{
Mutation mutation = new Mutation(keyspace, key);
QueryProcessor.validateKeyAlias(metadata, keyName);
if (columns.size() < 1)
{
// No columns, delete the partition
mutation.delete(columnFamily, (timestamp == null) ? getTimestamp(clientState) : timestamp);
}
else
{
// Delete specific columns
AbstractType<?> at = metadata.comparator.asAbstractType();
for (Term column : columns)
{
CellName columnName = metadata.comparator.cellFromByteBuffer(column.getByteBuffer(at, variables));
validateColumnName(columnName);
mutation.delete(columnFamily, columnName, (timestamp == null) ? getTimestamp(clientState) : timestamp);
}
}
return mutation;
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:27,代码来源:DeleteStatement.java
示例3: deserialize
import org.apache.cassandra.db.composites.CellName; //导入依赖的package包/类
public Future<Pair<CounterCacheKey, ClockAndCount>> deserialize(DataInputStream in, final ColumnFamilyStore cfs) throws IOException
{
final ByteBuffer partitionKey = ByteBufferUtil.readWithLength(in);
final CellName cellName = cfs.metadata.comparator.cellFromByteBuffer(ByteBufferUtil.readWithLength(in));
return StageManager.getStage(Stage.READ).submit(new Callable<Pair<CounterCacheKey, ClockAndCount>>()
{
public Pair<CounterCacheKey, ClockAndCount> call() throws Exception
{
DecoratedKey key = cfs.partitioner.decorateKey(partitionKey);
QueryFilter filter = QueryFilter.getNamesFilter(key,
cfs.metadata.cfName,
FBUtilities.singleton(cellName, cfs.metadata.comparator),
Long.MIN_VALUE);
ColumnFamily cf = cfs.getTopLevelColumns(filter, Integer.MIN_VALUE);
if (cf == null)
return null;
Cell cell = cf.getColumn(cellName);
if (cell == null || !cell.isLive(Long.MIN_VALUE))
return null;
ClockAndCount clockAndCount = CounterContext.instance().getLocalClockAndCount(cell.value());
return Pair.create(CounterCacheKey.create(cfs.metadata.cfId, partitionKey, cellName), clockAndCount);
}
});
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:25,代码来源:CacheService.java
示例4: insert
import org.apache.cassandra.db.composites.CellName; //导入依赖的package包/类
public void insert(ByteBuffer rowKey, Cell cell, OpOrder.Group opGroup)
{
DecoratedKey valueKey = getIndexKeyFor(getIndexedValue(rowKey, cell));
ColumnFamily cfi = ArrayBackedSortedColumns.factory.create(indexCfs.metadata, false, 1);
CellName name = makeIndexColumnName(rowKey, cell);
if (cell instanceof ExpiringCell)
{
ExpiringCell ec = (ExpiringCell) cell;
cfi.addColumn(new BufferExpiringCell(name, ByteBufferUtil.EMPTY_BYTE_BUFFER, ec.timestamp(), ec.getTimeToLive(), ec.getLocalDeletionTime()));
}
else
{
cfi.addColumn(new BufferCell(name, ByteBufferUtil.EMPTY_BYTE_BUFFER, cell.timestamp()));
}
if (logger.isDebugEnabled())
logger.debug("applying index row {} in {}", indexCfs.metadata.getKeyValidator().getString(valueKey.getKey()), cfi);
indexCfs.apply(valueKey, cfi, SecondaryIndexManager.nullUpdater, opGroup, null);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:20,代码来源:AbstractSimplePerColumnSecondaryIndex.java
示例5: SSTableNamesIterator
import org.apache.cassandra.db.composites.CellName; //导入依赖的package包/类
public SSTableNamesIterator(SSTableReader sstable, DecoratedKey key, SortedSet<CellName> columns)
{
assert columns != null;
this.sstable = sstable;
this.columns = columns;
this.key = key;
RowIndexEntry indexEntry = sstable.getPosition(key, SSTableReader.Operator.EQ);
if (indexEntry == null)
return;
try
{
read(sstable, null, indexEntry);
}
catch (IOException e)
{
sstable.markSuspect();
throw new CorruptSSTableException(e, sstable.getFilename());
}
finally
{
if (fileToClose != null)
FileUtils.closeQuietly(fileToClose);
}
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:27,代码来源:SSTableNamesIterator.java
示例6: readSimpleColumns
import org.apache.cassandra.db.composites.CellName; //导入依赖的package包/类
private void readSimpleColumns(FileDataInput file, SortedSet<CellName> columnNames, List<OnDiskAtom> result)
{
Iterator<OnDiskAtom> atomIterator = cf.metadata().getOnDiskIterator(file, sstable.descriptor.version);
int n = 0;
while (atomIterator.hasNext())
{
OnDiskAtom column = atomIterator.next();
if (column instanceof Cell)
{
if (columnNames.contains(column.name()))
{
result.add(column);
if (++n >= columns.size())
break;
}
}
else
{
result.add(column);
}
}
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:23,代码来源:SSTableNamesIterator.java
示例7: retryDummyRead
import org.apache.cassandra.db.composites.CellName; //导入依赖的package包/类
private void retryDummyRead(String ks, String cf) throws PermanentBackendException {
final long limit = System.currentTimeMillis() + (60L * 1000L);
while (System.currentTimeMillis() < limit) {
try {
SortedSet<CellName> names = new TreeSet<>(new Comparator<CellName>() {
// This is a singleton set. We need to define a comparator because SimpleDenseCellName is not
// comparable, but it doesn't have to be a useful comparator
@Override
public int compare(CellName o1, CellName o2)
{
return 0;
}
});
names.add(CellNames.simpleDense(ByteBufferUtil.zeroByteBuffer(1)));
NamesQueryFilter nqf = new NamesQueryFilter(names);
SliceByNamesReadCommand cmd = new SliceByNamesReadCommand(ks, ByteBufferUtil.zeroByteBuffer(1), cf, 1L, nqf);
StorageProxy.read(ImmutableList.<ReadCommand> of(cmd), ConsistencyLevel.QUORUM);
log.info("Read on CF {} in KS {} succeeded", cf, ks);
return;
} catch (Throwable t) {
log.warn("Failed to read CF {} in KS {} following creation", cf, ks, t);
}
try {
Thread.sleep(1000L);
} catch (InterruptedException e) {
throw new PermanentBackendException(e);
}
}
throw new PermanentBackendException("Timed out while attempting to read CF " + cf + " in KS " + ks + " following creation");
}
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:35,代码来源:CassandraEmbeddedStoreManager.java
示例8: execute
import org.apache.cassandra.db.composites.CellName; //导入依赖的package包/类
public void execute(ByteBuffer rowKey, ColumnFamily cf, Composite prefix, UpdateParameters params) throws InvalidRequestException
{
if (column.type.isMultiCell())
{
// delete + add
CellName name = cf.getComparator().create(prefix, column);
cf.addAtom(params.makeTombstoneForOverwrite(name.slice()));
}
Adder.doAdd(t, cf, prefix, column, params);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:11,代码来源:Sets.java
示例9: collectionColumns
import org.apache.cassandra.db.composites.CellName; //导入依赖的package包/类
protected Iterator<Cell> collectionColumns(CellName collection, ColumnFamily cf, final long now)
{
// We are testing for collection equality, so we need to have the expected values *and* only those.
ColumnSlice[] collectionSlice = new ColumnSlice[]{ collection.slice() };
// Filter live columns, this makes things simpler afterwards
return Iterators.filter(cf.iterator(collectionSlice), new Predicate<Cell>()
{
public boolean apply(Cell c)
{
// we only care about live columns
return c.isLive(now);
}
});
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:15,代码来源:ColumnCondition.java
示例10: appliesTo
import org.apache.cassandra.db.composites.CellName; //导入依赖的package包/类
public boolean appliesTo(Composite rowPrefix, ColumnFamily current, long now) throws InvalidRequestException
{
CellName name = current.metadata().comparator.create(rowPrefix, column);
for (ByteBuffer value : inValues)
{
if (isSatisfiedByValue(value, current.getColumn(name), column.type, Operator.EQ, now))
return true;
}
return false;
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:11,代码来源:ColumnCondition.java
示例11: execute
import org.apache.cassandra.db.composites.CellName; //导入依赖的package包/类
public void execute(ByteBuffer rowKey, ColumnFamily cf, Composite prefix, UpdateParameters params) throws InvalidRequestException
{
if (column.type.isMultiCell())
{
// delete + append
CellName name = cf.getComparator().create(prefix, column);
cf.addAtom(params.makeTombstoneForOverwrite(name.slice()));
}
Appender.doAppend(t, cf, prefix, column, params);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:11,代码来源:Lists.java
示例12: doAppend
import org.apache.cassandra.db.composites.CellName; //导入依赖的package包/类
static void doAppend(Term t, ColumnFamily cf, Composite prefix, ColumnDefinition column, UpdateParameters params) throws InvalidRequestException
{
Term.Terminal value = t.bind(params.options);
Lists.Value listValue = (Lists.Value)value;
if (column.type.isMultiCell())
{
// If we append null, do nothing. Note that for Setter, we've
// already removed the previous value so we're good here too
if (value == null)
return;
List<ByteBuffer> toAdd = listValue.elements;
for (int i = 0; i < toAdd.size(); i++)
{
ByteBuffer uuid = ByteBuffer.wrap(UUIDGen.getTimeUUIDBytes());
cf.addColumn(params.makeColumn(cf.getComparator().create(prefix, column, uuid), toAdd.get(i)));
}
}
else
{
// for frozen lists, we're overwriting the whole cell value
CellName name = cf.getComparator().create(prefix, column);
if (value == null)
cf.addAtom(params.makeTombstone(name));
else
cf.addColumn(params.makeColumn(name, listValue.getWithProtocolVersion(Server.CURRENT_VERSION)));
}
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:29,代码来源:Lists.java
示例13: execute
import org.apache.cassandra.db.composites.CellName; //导入依赖的package包/类
public void execute(ByteBuffer rowKey, ColumnFamily cf, Composite prefix, UpdateParameters params) throws InvalidRequestException
{
ByteBuffer bytes = t.bindAndGet(params.options);
if (bytes == null)
throw new InvalidRequestException("Invalid null value for counter increment");
long increment = ByteBufferUtil.toLong(bytes);
CellName cname = cf.getComparator().create(prefix, column);
cf.addColumn(params.makeCounter(cname, increment));
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:10,代码来源:Constants.java
示例14: serialize
import org.apache.cassandra.db.composites.CellName; //导入依赖的package包/类
public void serialize(NamesQueryFilter f, DataOutputPlus out, int version) throws IOException
{
out.writeInt(f.columns.size());
ISerializer<CellName> serializer = type.cellSerializer();
for (CellName cName : f.columns)
{
serializer.serialize(cName, out);
}
out.writeBoolean(f.countCQL3Rows);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:11,代码来源:NamesQueryFilter.java
示例15: execute
import org.apache.cassandra.db.composites.CellName; //导入依赖的package包/类
public void execute(ByteBuffer rowKey, ColumnFamily cf, Composite prefix, UpdateParameters params) throws InvalidRequestException
{
if (column.type.isMultiCell())
{
// delete + put
CellName name = cf.getComparator().create(prefix, column);
cf.addAtom(params.makeTombstoneForOverwrite(name.slice()));
}
Putter.doPut(t, cf, prefix, column, params);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:11,代码来源:Maps.java
示例16: getColumnNames
import org.apache.cassandra.db.composites.CellName; //导入依赖的package包/类
private static SortedSet<CellName> getColumnNames(SelectStatement select, CFMetaData metadata, List<ByteBuffer> variables)
throws InvalidRequestException
{
String keyString = metadata.getCQL2KeyName();
List<Term> selectColumnNames = select.getColumnNames();
SortedSet<CellName> columnNames = new TreeSet<>(metadata.comparator);
for (Term column : selectColumnNames)
{
// skip the key for the slice op; we'll add it to the resultset in extractThriftColumns
if (!column.getText().equalsIgnoreCase(keyString))
columnNames.add(metadata.comparator.cellFromByteBuffer(column.getByteBuffer(metadata.comparator.asAbstractType(),variables)));
}
return columnNames;
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:15,代码来源:QueryProcessor.java
示例17: validateColumnNames
import org.apache.cassandra.db.composites.CellName; //导入依赖的package包/类
private static void validateColumnNames(Iterable<CellName> columns)
throws InvalidRequestException
{
for (CellName name : columns)
{
if (name.dataSize() > org.apache.cassandra.db.Cell.MAX_NAME_LENGTH)
throw new InvalidRequestException(String.format("column name is too long (%s > %s)",
name.dataSize(),
org.apache.cassandra.db.Cell.MAX_NAME_LENGTH));
if (name.isEmpty())
throw new InvalidRequestException("zero-length column name");
}
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:14,代码来源:QueryProcessor.java
示例18: create
import org.apache.cassandra.db.composites.CellName; //导入依赖的package包/类
public static Cell create(CellName name, ByteBuffer value, long timestamp, int ttl, CFMetaData metadata)
{
if (ttl <= 0)
ttl = metadata.getDefaultTimeToLive();
return ttl > 0
? new BufferExpiringCell(name, value, timestamp, ttl)
: new BufferCell(name, value, timestamp);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:10,代码来源:AbstractCell.java
示例19: asMap
import org.apache.cassandra.db.composites.CellName; //导入依赖的package包/类
public Map<CellName, ByteBuffer> asMap()
{
ImmutableMap.Builder<CellName, ByteBuffer> builder = ImmutableMap.builder();
for (Cell cell : this)
builder.put(cell.name(), cell.value());
return builder.build();
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:8,代码来源:ColumnFamily.java
示例20: deserializeFromSSTable
import org.apache.cassandra.db.composites.CellName; //导入依赖的package包/类
public OnDiskAtom deserializeFromSSTable(DataInput in, ColumnSerializer.Flag flag, int expireBefore, Descriptor.Version version) throws IOException
{
Composite name = type.serializer().deserialize(in);
if (name.isEmpty())
{
// SSTableWriter.END_OF_ROW
return null;
}
int b = in.readUnsignedByte();
if ((b & ColumnSerializer.RANGE_TOMBSTONE_MASK) != 0)
return type.rangeTombstoneSerializer().deserializeBody(in, name, version);
else
return type.columnSerializer().deserializeColumnBody(in, (CellName)name, b, flag, expireBefore);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:16,代码来源:OnDiskAtom.java
注:本文中的org.apache.cassandra.db.composites.CellName类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论