Package org.apache.cassandra.db.view
Class TableViews
- java.lang.Object
-
- java.util.AbstractCollection<View>
-
- org.apache.cassandra.db.view.TableViews
-
-
Constructor Summary
Constructors Constructor Description TableViews(TableId id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(View view)
java.lang.Iterable<ColumnFamilyStore>
allViewsCfs()
void
build()
boolean
contains(java.lang.String viewName)
void
dumpMemtables()
void
forceBlockingFlush(ColumnFamilyStore.FlushReason reason)
java.util.Iterator<java.util.Collection<Mutation>>
generateViewUpdates(java.util.Collection<View> views, UnfilteredRowIterator updates, UnfilteredRowIterator existings, long nowInSec, boolean separateUpdates)
Given some updates on the base table of this object and the existing values for the rows affected by that update, generates the mutation to be applied to the provided views.boolean
hasViews()
java.util.Iterator<View>
iterator()
void
pushViewReplicaUpdates(PartitionUpdate update, boolean writeCommitLog, java.util.concurrent.atomic.AtomicLong baseComplete)
Calculates and pushes updates to the views replicas.void
removeByName(java.lang.String viewName)
int
size()
void
stopBuild()
void
truncateBlocking(CommitLogPosition replayAfter, long truncatedAt)
java.util.Collection<View>
updatedViews(PartitionUpdate updates)
Return the views that are potentially updated by the provided updates.-
Methods inherited from class java.util.AbstractCollection
addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Constructor Detail
-
TableViews
public TableViews(TableId id)
-
-
Method Detail
-
hasViews
public boolean hasViews()
-
size
public int size()
-
iterator
public java.util.Iterator<View> iterator()
-
contains
public boolean contains(java.lang.String viewName)
-
add
public boolean add(View view)
-
allViewsCfs
public java.lang.Iterable<ColumnFamilyStore> allViewsCfs()
-
build
public void build()
-
stopBuild
public void stopBuild()
-
forceBlockingFlush
public void forceBlockingFlush(ColumnFamilyStore.FlushReason reason)
-
dumpMemtables
public void dumpMemtables()
-
truncateBlocking
public void truncateBlocking(CommitLogPosition replayAfter, long truncatedAt)
-
removeByName
public void removeByName(java.lang.String viewName)
-
pushViewReplicaUpdates
public void pushViewReplicaUpdates(PartitionUpdate update, boolean writeCommitLog, java.util.concurrent.atomic.AtomicLong baseComplete)
Calculates and pushes updates to the views replicas. The replicas are determined byViewUtils#getViewNaturalEndpoint(String, Token, Token)
.- Parameters:
update
- an update on the base table represented by this object.writeCommitLog
- whether we should write the commit log for the view updates.baseComplete
- time from epoch in ms that the local base mutation was (or will be) completed
-
generateViewUpdates
public java.util.Iterator<java.util.Collection<Mutation>> generateViewUpdates(java.util.Collection<View> views, UnfilteredRowIterator updates, UnfilteredRowIterator existings, long nowInSec, boolean separateUpdates)
Given some updates on the base table of this object and the existing values for the rows affected by that update, generates the mutation to be applied to the provided views.- Parameters:
views
- the views potentially affected byupdates
.updates
- the base table updates being applied.existings
- the existing values for the rows affected byupdates
. This is used to decide if a view is obsoleted by the update and should be removed, gather the values for columns that may not be part of the update if a new view entry needs to be created, and compute the minimal updates to be applied if the view entry isn't changed but has simply some updated values. This will be empty for view building as we want to assume anything we'll pass toupdates
is new.nowInSec
- the current time in seconds.separateUpdates
- if false, mutation is per partition.- Returns:
- the mutations to apply to the
views
. This can be empty.
-
updatedViews
public java.util.Collection<View> updatedViews(PartitionUpdate updates)
Return the views that are potentially updated by the provided updates.- Parameters:
updates
- the updates applied to the base table.- Returns:
- the views affected by
updates
.
-
-