Package org.apache.cassandra.db.view
Class TableViews
- All Implemented Interfaces:
Iterable<View>,Collection<View>
Groups all the views for a given table.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidbuild()booleanvoidvoidgenerateViewUpdates(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.booleanhasViews()iterator()voidpushViewReplicaUpdates(PartitionUpdate update, boolean writeCommitLog, AtomicLong baseComplete) Calculates and pushes updates to the views replicas.voidremoveByName(String viewName) intsize()voidvoidtruncateBlocking(CommitLogPosition replayAfter, long truncatedAt) 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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
-
Constructor Details
-
TableViews
-
-
Method Details
-
hasViews
public boolean hasViews() -
size
public int size()- Specified by:
sizein interfaceCollection<View>- Specified by:
sizein classAbstractCollection<View>
-
iterator
- Specified by:
iteratorin interfaceCollection<View>- Specified by:
iteratorin interfaceIterable<View>- Specified by:
iteratorin classAbstractCollection<View>
-
contains
-
add
- Specified by:
addin interfaceCollection<View>- Overrides:
addin classAbstractCollection<View>
-
allViewsCfs
-
build
public void build() -
stopBuild
public void stopBuild() -
forceBlockingFlush
-
dumpMemtables
public void dumpMemtables() -
truncateBlocking
-
removeByName
-
pushViewReplicaUpdates
public void pushViewReplicaUpdates(PartitionUpdate update, boolean writeCommitLog, 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 Iterator<Collection<Mutation>> generateViewUpdates(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 toupdatesis 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
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.
-