Class ContentMirrorStoreStrategy

  • All Implemented Interfaces:
    IndexStoreStrategy

    public class ContentMirrorStoreStrategy
    extends java.lang.Object
    implements IndexStoreStrategy
    An IndexStoreStrategy implementation that saves the nodes under a hierarchy that mirrors the repository tree.
    This should minimize the chance that concurrent updates overlap on the same content node.

    For example for a node that is under /test/node, the index structure will be /oak:index/index/test/node:
     
     /
       test
         node
       oak:index
         index
           test
             node
     
     
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int TRAVERSING_WARN
      logging a warning every oak.traversing.warn traversed nodes.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long count​(Filter filter, NodeState root, NodeState indexMeta, java.util.Set<java.lang.String> values, int max)
      Count the occurrence of a given set of values.
      long count​(NodeState root, NodeState indexMeta, java.util.Set<java.lang.String> values, int max)
      Count the occurrence of a given set of values.
      boolean exists​(Supplier<NodeBuilder> index, java.lang.String key)
      Check whether an entry for the given key exists.
      java.lang.String getIndexNodeName()  
      java.lang.Iterable<java.lang.String> query​(Filter filter, java.lang.String name, NodeState indexMeta, java.lang.Iterable<java.lang.String> values)
      Search for a given set of values.
      java.lang.Iterable<java.lang.String> query​(Filter filter, java.lang.String indexName, NodeState indexMeta, java.lang.String indexStorageNodeName, java.lang.Iterable<java.lang.String> values)  
      void update​(Supplier<NodeBuilder> index, java.lang.String path, @Nullable java.lang.String indexName, @Nullable NodeBuilder indexMeta, java.util.Set<java.lang.String> beforeKeys, java.util.Set<java.lang.String> afterKeys)
      Updates the index for the given path.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • TRAVERSING_WARN

        public static final int TRAVERSING_WARN
        logging a warning every oak.traversing.warn traversed nodes. Default 10000
    • Constructor Detail

      • ContentMirrorStoreStrategy

        public ContentMirrorStoreStrategy()
      • ContentMirrorStoreStrategy

        public ContentMirrorStoreStrategy​(java.lang.String indexName)
      • ContentMirrorStoreStrategy

        public ContentMirrorStoreStrategy​(java.lang.String indexName,
                                          java.lang.String pathPrefix,
                                          boolean prependPathPrefix)
        Constructs a ContentMirrorStoreStrategy
        Parameters:
        indexName - name of sub node under which paths are stored
        pathPrefix - path of the index in repository. Defaults to empty for indexes at root nodes i.e. those stored directly under '/oak:index'. For non root index its the path excluding the '/oak:index' node. For e.g. for index at '/content/oak:index/fooIndex' the pathPrefix would be '/content'. If this is appened to the paths returned by index then they would become absolute path in repository
        prependPathPrefix - Should the path prefix be added to the query result
    • Method Detail

      • update

        public void update​(Supplier<NodeBuilder> index,
                           java.lang.String path,
                           @Nullable
                           @Nullable java.lang.String indexName,
                           @Nullable
                           @Nullable NodeBuilder indexMeta,
                           java.util.Set<java.lang.String> beforeKeys,
                           java.util.Set<java.lang.String> afterKeys)
        Description copied from interface: IndexStoreStrategy
        Updates the index for the given path.
        Specified by:
        update in interface IndexStoreStrategy
        Parameters:
        index - the index node supplier
        path - path stored in the index
        indexName - the name of the index. May be null.
        indexMeta - the definition of the index. May be null.
        beforeKeys - keys that no longer apply to the path
        afterKeys - keys that now do apply to the path
      • query

        public java.lang.Iterable<java.lang.String> query​(Filter filter,
                                                          java.lang.String indexName,
                                                          NodeState indexMeta,
                                                          java.lang.String indexStorageNodeName,
                                                          java.lang.Iterable<java.lang.String> values)
      • query

        public java.lang.Iterable<java.lang.String> query​(Filter filter,
                                                          java.lang.String name,
                                                          NodeState indexMeta,
                                                          java.lang.Iterable<java.lang.String> values)
        Description copied from interface: IndexStoreStrategy
        Search for a given set of values.
        Specified by:
        query in interface IndexStoreStrategy
        Parameters:
        filter - the filter (can optionally be used for optimized query execution)
        name - the name of the index (for logging)
        indexMeta - the index metadata node (may not be null)
        values - values to look for (null to check for property existence)
        Returns:
        an iterator of paths
      • count

        public long count​(NodeState root,
                          NodeState indexMeta,
                          java.util.Set<java.lang.String> values,
                          int max)
        Description copied from interface: IndexStoreStrategy
        Count the occurrence of a given set of values. Used in calculating the cost of an index.
        Specified by:
        count in interface IndexStoreStrategy
        Parameters:
        root - the root node (may not be null)
        indexMeta - the index metadata node (may not be null)
        values - values to look for (null to check for property existence)
        max - the maximum value to return
        Returns:
        the aggregated count of occurrences for each provided value
      • count

        public long count​(Filter filter,
                          NodeState root,
                          NodeState indexMeta,
                          java.util.Set<java.lang.String> values,
                          int max)
        Description copied from interface: IndexStoreStrategy
        Count the occurrence of a given set of values. Used in calculating the cost of an index.
        Specified by:
        count in interface IndexStoreStrategy
        Parameters:
        filter - the filter which can be used to estimate better cost
        root - the root node (may not be null)
        indexMeta - the index metadata node (may not be null)
        values - values to look for (null to check for property existence)
        max - the maximum value to return
        Returns:
        the aggregated count of occurrences for each provided value
      • exists

        public boolean exists​(Supplier<NodeBuilder> index,
                              java.lang.String key)
        Description copied from interface: IndexStoreStrategy
        Check whether an entry for the given key exists.
        Specified by:
        exists in interface IndexStoreStrategy
        Parameters:
        index - the index node supplier
        key - the key
        Returns:
        true if at least one entry exists