LSSTApplications  8.0.0.0+107,8.0.0.1+13,9.1+18,9.2,master-g084aeec0a4,master-g0aced2eed8+6,master-g15627eb03c,master-g28afc54ef9,master-g3391ba5ea0,master-g3d0fb8ae5f,master-g4432ae2e89+36,master-g5c3c32f3ec+17,master-g60f1e072bb+1,master-g6a3ac32d1b,master-g76a88a4307+1,master-g7bce1f4e06+57,master-g8ff4092549+31,master-g98e65bf68e,master-ga6b77976b1+53,master-gae20e2b580+3,master-gb584cd3397+53,master-gc5448b162b+1,master-gc54cf9771d,master-gc69578ece6+1,master-gcbf758c456+22,master-gcec1da163f+63,master-gcf15f11bcc,master-gd167108223,master-gf44c96c709
LSSTDataManagementBasePackage
ChunkManager.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2008, 2009, 2010 LSST Corporation.
6  *
7  * This product includes software developed by the
8  * LSST Project (http://www.lsst.org/).
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the LSST License Statement and
21  * the GNU General Public License along with this program. If not,
22  * see <http://www.lsstcorp.org/LegalNotices/>.
23  */
24 
25 
33 #ifndef LSST_AP_CHUNK_MANAGER_H
34 #define LSST_AP_CHUNK_MANAGER_H
35 
36 #include <iosfwd>
37 
38 #include "ChunkManagerImpl.h"
39 #include "Object.h"
40 
41 
42 namespace lsst { namespace ap {
43 
46 
47 private :
48 
50 
52 
53  static Manager * instance(std::string const & name);
54 
55 public :
56 
58 
59  SharedObjectChunkManager(std::string const & name);
60 
61  bool isVisitInFlight(int const visitId) {
62  return _manager->isVisitInFlight(visitId);
63  }
64  void registerVisit(int const visitId) {
65  _manager->registerVisit(visitId);
66  }
67  void failVisit(int const visitId) {
68  _manager->failVisit(visitId);
69  }
70 
71  void startVisit(
72  std::vector<ObjectChunk> & toRead,
73  std::vector<ObjectChunk> & toWaitFor,
74  int const visitId,
75  std::vector<int> const & chunkIds
76  ) {
77  _manager->startVisit(toRead, toWaitFor, visitId, chunkIds);
78  }
79 
81  std::vector<ObjectChunk> & toRead,
82  std::vector<ObjectChunk> & toWaitFor,
83  int const visitId,
84  TimeSpec const & deadline
85  ) {
86  _manager->waitForOwnership(toRead, toWaitFor, visitId, deadline);
87  }
88 
89  void getChunks(
90  std::vector<ObjectChunk> & chunks,
91  std::vector<int> const & chunkIds
92  ) {
93  _manager->getChunks(chunks, chunkIds);
94  }
95 
96  bool endVisit(int const visitId, bool const rollback) {
97  return _manager->endVisit(visitId, rollback);
98  }
99 
100  void printVisits(std::ostream & os) const {
101  _manager->printVisits(os);
102  }
103  void printChunks(std::ostream & os) const {
104  _manager->printChunks(os);
105  }
106  void printVisit(int const visitId, std::ostream & os) const {
107  _manager->printVisit(visitId, os);
108  }
109  void printChunk(int const chunkId, std::ostream & os) const {
110  _manager->printChunk(chunkId, os);
111  }
112 
113  static void destroyInstance(std::string const & name);
114 
115  static std::size_t size();
116 };
117 
118 
119 }} // end of namespace lsst::ap
120 
121 #endif // LSST_AP_CHUNK_MANAGER_H
bool endVisit(int const visitId, bool const rollback)
Definition: ChunkManager.h:96
A manager for a set of chunks of a single type.
Wraps the C library timespec struct.
Definition: Time.h:48
void printVisit(int const visitId, std::ostream &os) const
void registerVisit(int const visitId)
Definition: ChunkManager.h:64
A manager for Object chunks that exist in shared memory.
Definition: ChunkManager.h:45
void waitForOwnership(std::vector< Chunk > &toRead, std::vector< Chunk > &toWaitFor, int const visitId, TimeSpec const &deadline)
SharedObjectChunkManager(std::string const &name)
void failVisit(int const visitId)
Definition: ChunkManager.h:67
void printVisits(std::ostream &os) const
Definition: ChunkManager.h:100
void printVisit(int const visitId, std::ostream &os) const
Definition: ChunkManager.h:106
void printChunk(int const chunkId, std::ostream &os) const
Chunk manager helper classes.
static std::size_t size()
Returns the size in bytes of the underlying chunk manager and pool of memory blocks.
bool endVisit(int const visitId, bool const rollback)
void startVisit(std::vector< ObjectChunk > &toRead, std::vector< ObjectChunk > &toWaitFor, int const visitId, std::vector< int > const &chunkIds)
Definition: ChunkManager.h:71
void getChunks(std::vector< ObjectChunk > &chunks, std::vector< int > const &chunkIds)
Definition: ChunkManager.h:89
bool isVisitInFlight(int const visitId)
C++ representations of an LSST Object.
void printChunks(std::ostream &os) const
void getChunks(std::vector< Chunk > &chunks, std::vector< int > const &chunkIds)
detail::ChunkManagerImpl< SharedMutex, Object > Manager
Definition: ChunkManager.h:49
void printVisits(std::ostream &os) const
static void destroyInstance(std::string const &name)
void printChunks(std::ostream &os) const
Definition: ChunkManager.h:103
static Manager * instance(std::string const &name)
bool isVisitInFlight(int const visitId)
Definition: ChunkManager.h:61
void waitForOwnership(std::vector< ObjectChunk > &toRead, std::vector< ObjectChunk > &toWaitFor, int const visitId, TimeSpec const &deadline)
Definition: ChunkManager.h:80
void startVisit(std::vector< Chunk > &toRead, std::vector< Chunk > &toWaitFor, int const visitId, std::vector< int > const &chunkIds)
void registerVisit(int const visitId)
void printChunk(int const chunkId, std::ostream &os) const
Definition: ChunkManager.h:109