Oracle® Fusion Middleware C++ API Reference for Oracle Coherence
12c (12.2.1.3.0)

E80355-01

coherence/util/aggregator/QueryRecorder.hpp

00001 /*
00002 * QueryRecorder.hpp
00003 *
00004 * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
00005 *
00006 * Oracle is a registered trademarks of Oracle Corporation and/or its
00007 * affiliates.
00008 *
00009 * This software is the confidential and proprietary information of Oracle
00010 * Corporation. You shall not disclose such confidential and proprietary
00011 * information and shall use it only in accordance with the terms of the
00012 * license agreement you entered into with Oracle.
00013 *
00014 * This notice may not be removed or altered.
00015 */
00016 #ifndef COH_QUERY_RECORDER_HPP
00017 #define COH_QUERY_RECORDER_HPP
00018 
00019 #include "coherence/lang.ns"
00020 
00021 #include "coherence/io/pof/PofReader.hpp"
00022 #include "coherence/io/pof/PofWriter.hpp"
00023 #include "coherence/io/pof/PortableObject.hpp"
00024 #include "coherence/util/InvocableMap.hpp"
00025 
00026 COH_OPEN_NAMESPACE3(coherence,util,aggregator)
00027 
00028 using coherence::io::pof::PofReader;
00029 using coherence::io::pof::PofWriter;
00030 using coherence::io::pof::PortableObject;
00031 using coherence::util::InvocableMap;
00032 
00033 
00034 /**
00035 * This parallel aggregator used to produce a QueryRecord object that contains
00036 * an estimated or actual cost of the query execution for a given filter.
00037 *
00038 * For example, the following code will return a QueryPlan, containing the
00039 * estimated query cost and corresponding execution steps.
00040 *
00041 * <pre>
00042 *   QueryRecorder::Handle hAgent  = QueryRecorder::create(QueryRecorder::explain);
00043 *   QueryRecord::View     vRecord = cast<QueryRecord::View>(hCache->aggregate(filter, agent));
00044 * </pre>
00045 *
00046 * @since Coherence 3.7.1
00047 *
00048 * @author tb 2011.05.26
00049 */
00050 class COH_EXPORT QueryRecorder
00051     : public class_spec<QueryRecorder,
00052         extends<Object>,
00053         implements<PortableObject, InvocableMap::ParallelAwareAggregator> >
00054     {
00055     friend class factory<QueryRecorder>;
00056 
00057     // ----- RecordType enum ------------------------------------------------
00058 
00059     public:
00060         /**
00061         * RecordType enum specifies whether the {@link QueryRecorder} should
00062         * be used to produce a QueryRecord object that contains an estimated
00063         * or an actual cost of the query execution.
00064         */
00065         enum RecordType
00066             {
00067             /**
00068              * Produce a QueryRecord object that contains an estimated cost of
00069              * the query execution.
00070              */
00071             explain,
00072 
00073             /**
00074              * Produce a QueryRecord object that contains the actual cost of
00075              * the query execution.
00076              */
00077             trace
00078             };
00079 
00080 
00081     // ----- Constructors ---------------------------------------------------
00082 
00083     protected:
00084         /**
00085         * Default constructor (necessary for the PortableObject interface).
00086         */
00087         QueryRecorder();
00088 
00089         /**
00090         * Construct a QueryRecorder.
00091         *
00092         * @param type  the type for this aggregator
00093         */
00094         QueryRecorder(QueryRecorder::RecordType type);
00095 
00096 
00097     // ----- accessors ------------------------------------------------------
00098 
00099     public:
00100         /**
00101         * Get the record type for this query recorder.
00102         *
00103         * @return the record type enum
00104         */
00105         virtual QueryRecorder::RecordType getType() const;
00106 
00107 
00108     // ----- EntryAggregator interface --------------------------------------
00109 
00110     public:
00111         /**
00112         * {@inheritDoc}
00113         */
00114         virtual Object::Holder aggregate(Set::View vSetEntries);
00115 
00116 
00117     // ----- ParallelAwareAggregator interface ------------------------------
00118 
00119     public:
00120         /**
00121         * {@inheritDoc}
00122         */
00123         virtual InvocableMap::EntryAggregator::Handle getParallelAggregator();
00124 
00125         /**
00126         * {@inheritDoc}
00127         */
00128         virtual Object::Holder aggregateResults(
00129                     Collection::View vCollResults);
00130 
00131 
00132     // ----- PortableObject interface ---------------------------------------
00133 
00134     public:
00135         /**
00136         * {@inheritDoc}
00137         */
00138         virtual void readExternal(PofReader::Handle hIn);
00139 
00140         /**
00141         * {@inheritDoc}
00142         */
00143         virtual void writeExternal(PofWriter::Handle hOut) const;
00144 
00145 
00146     // ----- data members ---------------------------------------------------
00147 
00148     protected:
00149         /**
00150         * This aggregator record type.
00151         */
00152         enum RecordType m_type;
00153     };
00154 
00155 COH_CLOSE_NAMESPACE3
00156 
00157 #endif // COH_QUERY_RECORDER_HPP
Copyright © 2000, 2017, Oracle and/or its affiliates. All rights reserved.