Class BasicDatasourcePartitionManager

    • Constructor Detail

      • BasicDatasourcePartitionManager

        public BasicDatasourcePartitionManager​(GatewayContext context,
                                               java.lang.String dataSource,
                                               int driverId)
      • BasicDatasourcePartitionManager

        public BasicDatasourcePartitionManager​(GatewayContext context,
                                               java.lang.String queryId,
                                               java.lang.String dataSource,
                                               int driverId)
    • Method Detail

      • getLogger

        public LoggerEx getLogger()
      • getQueryCache

        public QueryCache getQueryCache()
      • getDriverId

        protected int getDriverId()
      • getDatasource

        protected Datasource getDatasource()
      • initialize

        public void initialize()
                        throws java.lang.Exception
        Specified by:
        initialize in interface PartitionManager
        Throws:
        java.lang.Exception
      • getPartition

        public Partition getPartition​(long time,
                                      long windowSize)
                               throws java.lang.Exception
        Description copied from interface: PartitionManager
        Retrieves the partition that contains the given time, as close to the resolution as possible
        Specified by:
        getPartition in interface PartitionManager
        Throws:
        java.lang.Exception
      • getOlderPartitions

        public java.util.List<Partition> getOlderPartitions​(long time,
                                                            long windowSize,
                                                            int limit)
                                                     throws java.lang.Exception
        Description copied from interface: PartitionManager
        Retrieves the partitions with data equal to or older than the specified time, sorted DESC (most recent first).
        Specified by:
        getOlderPartitions in interface PartitionManager
        limit - if 0, no limit, otherwise only returns up to that many partitions.
        Throws:
        java.lang.Exception
      • getPartitions

        public java.util.List<Partition> getPartitions​(long start,
                                                       long end,
                                                       long windowSize)
                                                throws java.lang.Exception
        Returns the partitions for a span of time, choosing the coarsest partitions available for the window size. The partition objects returned will be resized such that coarse partitions will not overlap with raw. In other words, it should be appropriate to simply loop through them and query data.
        Specified by:
        getPartitions in interface PartitionManager
        Throws:
        java.lang.Exception
      • runPartitionQuery

        protected java.util.List<Partition> runPartitionQuery​(java.lang.String query,
                                                              java.lang.Object... params)
                                                       throws java.lang.Exception
        Runs the getOlderPartitions and getPartitions queries.
        Throws:
        java.lang.Exception
      • loadPartitionFromDS

        protected Partition loadPartitionFromDS​(Dataset data)
        Returns the first partition defined in the dataset, or null if there isn't one.
      • loadPartitionsFromDS

        protected java.util.List<Partition> loadPartitionsFromDS​(Dataset data)
        Returns all of the partitions defined in a dataset.
      • getMostRecentPartitions

        public java.util.List<Partition> getMostRecentPartitions​(int count,
                                                                 long windowSize)
                                                          throws java.lang.Exception
        Description copied from interface: PartitionManager
        Retrieves partitions order by start time desc. Only returns up to the number specified by count.
        Specified by:
        getMostRecentPartitions in interface PartitionManager
        Throws:
        java.lang.Exception
      • deleteOldPartitions

        public void deleteOldPartitions​(long ageMS)
                                 throws java.lang.Exception
        Will delete all partitions older than the given age.
        Specified by:
        deleteOldPartitions in interface PartitionManager
        Throws:
        java.lang.Exception
      • partitionExists

        protected boolean partitionExists​(java.lang.String name)
                                   throws java.lang.Exception
        Throws:
        java.lang.Exception