ExecStreamGraph.h

Go to the documentation of this file.
00001 /*
00002 // $Id: //open/dev/fennel/exec/ExecStreamGraph.h#29 $
00003 // Fennel is a library of data storage and processing components.
00004 // Copyright (C) 2005-2009 The Eigenbase Project
00005 // Copyright (C) 2005-2009 SQLstream, Inc.
00006 // Copyright (C) 2005-2009 LucidEra, Inc.
00007 // Portions Copyright (C) 1999-2009 John V. Sichi
00008 //
00009 // This program is free software; you can redistribute it and/or modify it
00010 // under the terms of the GNU General Public License as published by the Free
00011 // Software Foundation; either version 2 of the License, or (at your option)
00012 // any later version approved by The Eigenbase Project.
00013 //
00014 // This program is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 // GNU General Public License for more details.
00018 //
00019 // You should have received a copy of the GNU General Public License
00020 // along with this program; if not, write to the Free Software
00021 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 */
00023 
00024 #ifndef Fennel_ExecStreamGraph_Included
00025 #define Fennel_ExecStreamGraph_Included
00026 
00027 #include "fennel/common/ClosableObject.h"
00028 #include <vector>
00029 #include <boost/utility.hpp>
00030 
00031 FENNEL_BEGIN_NAMESPACE
00032 
00037 typedef uint ExecStreamId;
00038 
00039 class ExecStreamGraphImpl;
00040 class ExecStreamScheduler;
00041 
00059 class FENNEL_EXEC_EXPORT ExecStreamGraph
00060     : public boost::noncopyable,
00061         public ClosableObject
00062 {
00063     friend class ExecStreamScheduler;
00064 
00065 protected:
00073     ExecStreamScheduler *pScheduler;
00074 
00078     SharedDynamicParamManager pDynamicParamManager;
00079 
00080     explicit ExecStreamGraph();
00081 
00082 public:
00088     static SharedExecStreamGraph newExecStreamGraph();
00089 
00090     virtual ~ExecStreamGraph();
00091 
00095     inline ExecStreamScheduler *getScheduler() const;
00096 
00100     inline SharedDynamicParamManager getDynamicParamManager();
00101 
00108     virtual void setTxn(
00109         SharedLogicalTxn pTxn) = 0;
00110 
00117     virtual void setErrorTarget(
00118         SharedErrorTarget pErrorTarget) = 0;
00119 
00126     virtual void setScratchSegment(
00127         SharedSegment pScratchSegment) = 0;
00128 
00134     virtual void setResourceGovernor(
00135         SharedExecStreamGovernor pResourceGovernor) = 0;
00136 
00140     virtual SharedLogicalTxn getTxn() = 0;
00141 
00145     virtual TxnId getTxnId() = 0;
00146 
00157     virtual void enableDummyTxnId(bool enabled) = 0;
00158 
00162     virtual SharedExecStreamGovernor getResourceGovernor() = 0;
00163 
00169     virtual void addStream(
00170         SharedExecStream pStream) = 0;
00171 
00177     virtual void removeStream(ExecStreamId) = 0;
00178 
00190     virtual void addDataflow(
00191         ExecStreamId producerId,
00192         ExecStreamId consumerId,
00193         bool isImplicit = false) = 0;
00194 
00200     virtual void addOutputDataflow(
00201         ExecStreamId producerId) = 0;
00202 
00208     virtual void addInputDataflow(
00209         ExecStreamId consumerId) = 0;
00210 
00217     virtual void mergeFrom(ExecStreamGraph& src) = 0;
00218 
00226     virtual void mergeFrom(
00227         ExecStreamGraph& src,
00228         std::vector<ExecStreamId> const& nodes) = 0;
00229 
00237     virtual SharedExecStream findStream(
00238         std::string name) = 0;
00239 
00249     virtual SharedExecStream findLastStream(
00250         std::string name,
00251         uint iOutput) = 0;
00252 
00264     virtual void interposeStream(
00265         std::string name,
00266         uint iOutput,
00267         ExecStreamId interposedId) = 0;
00268 
00275     virtual void prepare(ExecStreamScheduler &scheduler) = 0;
00276 
00281     virtual void open() = 0;
00282 
00290     virtual SharedExecStream getStream(ExecStreamId id) = 0;
00291 
00299     virtual uint getInputCount(
00300         ExecStreamId streamId) = 0;
00301 
00309     virtual uint getOutputCount(
00310         ExecStreamId streamId) = 0;
00311 
00321     virtual SharedExecStream getStreamInput(
00322         ExecStreamId streamId,
00323         uint iInput) = 0;
00324 
00334     virtual SharedExecStreamBufAccessor getStreamInputAccessor(
00335         ExecStreamId streamId,
00336         uint iInput) = 0;
00337 
00347     virtual SharedExecStream getStreamOutput(
00348         ExecStreamId streamId,
00349         uint iOutput) = 0;
00350 
00360     virtual SharedExecStreamBufAccessor getStreamOutputAccessor(
00361         ExecStreamId streamId,
00362         uint iOutput) = 0;
00363 
00369     virtual std::vector<SharedExecStream> getSortedStreams() = 0;
00370 
00375     virtual int getStreamCount() = 0;
00376 
00381     virtual int getDataflowCount() = 0;
00382 
00389     virtual void renderGraphviz(std::ostream &dotStream) = 0;
00390 
00394     virtual bool isAcyclic() = 0;
00395 
00401     virtual void closeProducers(ExecStreamId streamId) = 0;
00402 
00409     virtual void declareDynamicParamWriter(
00410         ExecStreamId streamId,
00411         DynamicParamId dynamicParamId) = 0;
00412 
00419     virtual void declareDynamicParamReader(
00420         ExecStreamId streamId,
00421         DynamicParamId dynamicParamId) = 0;
00422 
00429     virtual const std::vector<ExecStreamId> &getDynamicParamWriters(
00430         DynamicParamId dynamicParamId) = 0;
00431 
00432 
00439     virtual const std::vector<ExecStreamId> &getDynamicParamReaders(
00440         DynamicParamId dynamicParamId) = 0;
00441 
00442 };
00443 
00444 inline ExecStreamScheduler *ExecStreamGraph::getScheduler() const
00445 {
00446     return pScheduler;
00447 }
00448 
00449 inline SharedDynamicParamManager ExecStreamGraph::getDynamicParamManager()
00450 {
00451     return pDynamicParamManager;
00452 }
00453 
00454 FENNEL_END_NAMESPACE
00455 
00456 #endif
00457 
00458 // End ExecStreamGraph.h

Generated on Mon Jun 22 04:00:18 2009 for Fennel by  doxygen 1.5.1