Tabnine Logo
AbstractCell
Code IndexAdd Tabnine to your IDE (free)

How to use
AbstractCell
in
org.apache.cassandra.db.rows

Best Java code snippets using org.apache.cassandra.db.rows.AbstractCell (Showing top 20 results out of 315)

origin: jsevellec/cassandra-unit

@Override
public int hashCode()
{
  return Objects.hash(column(), isCounterCell(), timestamp(), ttl(), localDeletionTime(), value(), path());
}
origin: jsevellec/cassandra-unit

private String livenessInfoString()
{
  if (isExpiring())
    return String.format("ts=%d ttl=%d ldt=%d", timestamp(), ttl(), localDeletionTime());
  else if (isTombstone())
    return String.format("ts=%d ldt=%d", timestamp(), localDeletionTime());
  else
    return String.format("ts=%d", timestamp());
}
origin: jsevellec/cassandra-unit

public boolean isLive(int nowInSec)
{
  return localDeletionTime() == NO_DELETION_TIME || (ttl() != NO_TTL && nowInSec < localDeletionTime());
}
origin: jsevellec/cassandra-unit

@Override
public String toString()
{
  if (isCounterCell())
    return String.format("[%s=%d ts=%d]", column().name, CounterContext.instance().total(value()), timestamp());
  AbstractType<?> type = column().type;
  if (type instanceof CollectionType && type.isMultiCell())
  {
    CollectionType ct = (CollectionType)type;
    return String.format("[%s[%s]=%s %s]",
               column().name,
               ct.nameComparator().getString(path().get(0)),
               ct.valueComparator().getString(value()),
               livenessInfoString());
  }
  if (isTombstone())
    return String.format("[%s=<tombstone> %s]", column().name, livenessInfoString());
  else
    return String.format("[%s=%s %s]", column().name, type.getString(value()), livenessInfoString());
}
origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

public Cell purge(DeletionPurger purger, int nowInSec)
{
  if (!isLive(nowInSec))
  {
    if (purger.shouldPurge(timestamp(), localDeletionTime()))
      return null;
    // We slightly hijack purging to convert expired but not purgeable columns to tombstones. The reason we do that is
    // that once a column has expired it is equivalent to a tombstone but actually using a tombstone is more compact since
    // we don't keep the column value. The reason we do it here is that 1) it's somewhat related to dealing with tombstones
    // so hopefully not too surprising and 2) we want to this and purging at the same places, so it's simpler/more efficient
    // to do both here.
    if (isExpiring())
    {
      // Note that as long as the expiring column and the tombstone put together live longer than GC grace seconds,
      // we'll fulfil our responsibility to repair. See discussion at
      // http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/repair-compaction-and-tombstone-rows-td7583481.html
      return BufferCell.tombstone(column, timestamp(), localDeletionTime() - ttl(), path());
    }
  }
  return this;
}
origin: jsevellec/cassandra-unit

public Cell updateAllTimestamp(long newTimestamp)
{
  return new BufferCell(column, isTombstone() ? newTimestamp - 1 : newTimestamp, ttl(), localDeletionTime(), value(), path());
}
origin: org.apache.cassandra/cassandra-all

public void validate()
{
  if (ttl() < 0)
    throw new MarshalException("A TTL should not be negative");
  if (localDeletionTime() < 0)
    throw new MarshalException("A local deletion time should not be negative");
  if (isExpiring() && localDeletionTime() == NO_DELETION_TIME)
    throw new MarshalException("Shoud not have a TTL without an associated local deletion time");
  // non-frozen UDTs require both the cell path & value to validate,
  // so that logic is pushed down into ColumnDefinition. Tombstone
  // validation is done there too as it also involves the cell path
  // for complex columns
  column().validateCell(this);
}
origin: jsevellec/cassandra-unit

public long maxTimestamp()
{
  return timestamp();
}
origin: org.apache.cassandra/cassandra-all

public boolean isCounterCell()
{
  return !isTombstone() && column.isCounterColumn();
}
origin: jsevellec/cassandra-unit

public boolean isExpiring()
{
  return ttl() != NO_TTL;
}
origin: org.apache.cassandra/cassandra-all

@Override
public String toString()
{
  if (isCounterCell())
    return String.format("[%s=%d ts=%d]", column().name, CounterContext.instance().total(value()), timestamp());
  AbstractType<?> type = column().type;
  if (type instanceof CollectionType && type.isMultiCell())
  {
    CollectionType ct = (CollectionType)type;
    return String.format("[%s[%s]=%s %s]",
               column().name,
               ct.nameComparator().getString(path().get(0)),
               ct.valueComparator().getString(value()),
               livenessInfoString());
  }
  if (isTombstone())
    return String.format("[%s=<tombstone> %s]", column().name, livenessInfoString());
  else
    return String.format("[%s=%s %s]", column().name, type.getString(value()), livenessInfoString());
}
origin: org.apache.cassandra/cassandra-all

public Cell purge(DeletionPurger purger, int nowInSec)
{
  if (!isLive(nowInSec))
  {
    if (purger.shouldPurge(timestamp(), localDeletionTime()))
      return null;
    // We slightly hijack purging to convert expired but not purgeable columns to tombstones. The reason we do that is
    // that once a column has expired it is equivalent to a tombstone but actually using a tombstone is more compact since
    // we don't keep the column value. The reason we do it here is that 1) it's somewhat related to dealing with tombstones
    // so hopefully not too surprising and 2) we want to this and purging at the same places, so it's simpler/more efficient
    // to do both here.
    if (isExpiring())
    {
      // Note that as long as the expiring column and the tombstone put together live longer than GC grace seconds,
      // we'll fulfil our responsibility to repair. See discussion at
      // http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/repair-compaction-and-tombstone-rows-td7583481.html
      return BufferCell.tombstone(column, timestamp(), localDeletionTime() - ttl(), path()).purge(purger, nowInSec);
    }
  }
  return this;
}
origin: org.apache.cassandra/cassandra-all

public Cell updateAllTimestamp(long newTimestamp)
{
  return new BufferCell(column, isTombstone() ? newTimestamp - 1 : newTimestamp, ttl(), localDeletionTime(), value(), path());
}
origin: jsevellec/cassandra-unit

public void validate()
{
  if (ttl() < 0)
    throw new MarshalException("A TTL should not be negative");
  if (localDeletionTime() < 0)
    throw new MarshalException("A local deletion time should not be negative");
  if (isExpiring() && localDeletionTime() == NO_DELETION_TIME)
    throw new MarshalException("Shoud not have a TTL without an associated local deletion time");
  // non-frozen UDTs require both the cell path & value to validate,
  // so that logic is pushed down into ColumnDefinition. Tombstone
  // validation is done there too as it also involves the cell path
  // for complex columns
  column().validateCell(this);
}
origin: org.apache.cassandra/cassandra-all

public boolean isLive(int nowInSec)
{
  return localDeletionTime() == NO_DELETION_TIME || (ttl() != NO_TTL && nowInSec < localDeletionTime());
}
origin: org.apache.cassandra/cassandra-all

public long maxTimestamp()
{
  return timestamp();
}
origin: jsevellec/cassandra-unit

public boolean isCounterCell()
{
  return !isTombstone() && column.isCounterColumn();
}
origin: org.apache.cassandra/cassandra-all

public boolean isExpiring()
{
  return ttl() != NO_TTL;
}
origin: org.apache.cassandra/cassandra-all

@Override
public int hashCode()
{
  return Objects.hash(column(), isCounterCell(), timestamp(), ttl(), localDeletionTime(), value(), path());
}
origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

@Override
public String toString()
{
  if (isCounterCell())
    return String.format("[%s=%d ts=%d]", column().name, CounterContext.instance().total(value()), timestamp());
  AbstractType<?> type = column().type;
  if (type instanceof CollectionType && type.isMultiCell())
  {
    CollectionType ct = (CollectionType)type;
    return String.format("[%s[%s]=%s %s]",
               column().name,
               ct.nameComparator().getString(path().get(0)),
               ct.valueComparator().getString(value()),
               livenessInfoString());
  }
  if (isTombstone())
    return String.format("[%s=<tombstone> %s]", column().name, livenessInfoString());
  else
    return String.format("[%s=%s %s]", column().name, type.getString(value()), livenessInfoString());
}
org.apache.cassandra.db.rowsAbstractCell

Javadoc

Base abstract class for Cell implementations. Unless you have a very good reason not to, every cell implementation should probably extend this class.

Most used methods

  • column
  • isCounterCell
  • isExpiring
  • isLive
  • isTombstone
  • livenessInfoString
  • localDeletionTime
  • path
  • timestamp
  • ttl
  • value
  • value

Popular in Java

  • Reading from database using SQL prepared statement
  • onRequestPermissionsResult (Fragment)
  • notifyDataSetChanged (ArrayAdapter)
  • getSharedPreferences (Context)
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • BoxLayout (javax.swing)
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now