|
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
|
A manager for a set of chunks of a single type. More...
#include <ChunkManagerImpl.h>
Public Types | |
| typedef SubManager< MutexT, DataT, TraitsT > | Manager |
| typedef Manager::Chunk | Chunk |
Public Member Functions | |
| ChunkManagerImpl () | |
| bool | isVisitInFlight (int const visitId) |
| void | failVisit (int const visitId) |
| void | registerVisit (int const visitId) |
| void | startVisit (std::vector< Chunk > &toRead, std::vector< Chunk > &toWaitFor, int const visitId, std::vector< int > const &chunkIds) |
| void | waitForOwnership (std::vector< Chunk > &toRead, std::vector< Chunk > &toWaitFor, int const visitId, TimeSpec const &deadline) |
| void | getChunks (std::vector< Chunk > &chunks, std::vector< int > const &chunkIds) |
| bool | endVisit (int const visitId, bool const rollback) |
| void | printVisits (std::ostream &os) const |
| void | printChunks (std::ostream &os) const |
| void | printVisit (int const visitId, std::ostream &os) const |
| void | printChunk (int const chunkId, std::ostream &os) const |
Static Public Member Functions | |
| static std::size_t | size () |
Private Member Functions | |
| void | rollbackAllExcept (int const visitId) |
Static Private Member Functions | |
| static std::size_t | blocks () |
| Returns the offset of the first data block (relative to its manager). More... | |
Private Attributes | |
| MutexT | _mutex |
| Condition< MutexT > | _ownerCondition |
| VisitTracker | _visits |
| Manager | _data |
A manager for a set of chunks of a single type.
Each instance is intended to be a header of (meaning: located in the initial bytes of) a large contiguous memory block M, which it then takes charge of managing. In particular, M will contain all chunk descriptors and data, as well as all data structures required for management tasks (visit tracking, memory allocation, and synchronization). M is initialized by calling the placement new operator with the address of M as a parameter. To avoid any data alignment issues, M should begin at an address that is a multiple of 16 bytes (or some larger power of 2).
Finally, note that instances of this class do not contain a single pointer - when necessary, offsets (relative to some known address, e.g. of the manager instance itself) are stored instead. This, in conjunction with an appropriate choice of mutex type, makes the class suitable for placement into shared memory.
Definition at line 292 of file ChunkManagerImpl.h.
| typedef Manager::Chunk lsst::ap::detail::ChunkManagerImpl< MutexT, DataT, TraitsT >::Chunk |
Definition at line 295 of file ChunkManagerImpl.h.
| typedef SubManager<MutexT, DataT, TraitsT> lsst::ap::detail::ChunkManagerImpl< MutexT, DataT, TraitsT >::Manager |
Definition at line 294 of file ChunkManagerImpl.h.
| lsst::ap::detail::ChunkManagerImpl< MutexT, DataT, TraitsT >::ChunkManagerImpl | ( | ) |
Definition at line 702 of file ChunkManagerImpl.cc.
|
inlinestaticprivate |
Returns the offset of the first data block (relative to its manager).
Definition at line 299 of file ChunkManagerImpl.h.
| bool lsst::ap::detail::ChunkManagerImpl< MutexT, DataT, TraitsT >::endVisit | ( | int const | visitId, |
| bool const | rollback | ||
| ) |
Relinquishes ownership of any chunks owned by the given visit (each chunk is passed on to its first interested party that is still in flight) and removes the given visit from the list of in-flight visits.
| [in] | visitId | The visit to remove from the set of in-flight visits being tracked |
| [in] | rollback | Flag indicating whether chunks should be rolled back (to the state they were in before being acquired by the given visit), or whether changes should be marked as committed. |
true if the visit existed, was not marked as a failure and was committed, false otherwise. Definition at line 879 of file ChunkManagerImpl.cc.
| void lsst::ap::detail::ChunkManagerImpl< MutexT, DataT, TraitsT >::failVisit | ( | int const | visitId | ) |
Marks the given visit a failure. If the given visit has not been previously registered, or has already been marked as failed, then the call has no effect.
Definition at line 720 of file ChunkManagerImpl.cc.
| void lsst::ap::detail::ChunkManagerImpl< MutexT, DataT, TraitsT >::getChunks | ( | std::vector< Chunk > & | chunks, |
| std::vector< int > const & | chunkIds | ||
| ) |
Returns a chunk for each identifier in the given list that corresponds to a managed chunk.
| [out] | chunks | The list to store chunks in. |
| [in] | chunkIds | The list of identifiers for which corresponding chunks are desired. |
Definition at line 856 of file ChunkManagerImpl.cc.
| bool lsst::ap::detail::ChunkManagerImpl< MutexT, DataT, TraitsT >::isVisitInFlight | ( | int const | visitId | ) |
Returns true if the given visit is in-flight and has not been marked as failed.
Definition at line 709 of file ChunkManagerImpl.cc.
| void lsst::ap::detail::ChunkManagerImpl< MutexT, DataT, TraitsT >::printChunk | ( | int const | chunkId, |
| std::ostream & | os | ||
| ) | const |
Definition at line 939 of file ChunkManagerImpl.cc.
| void lsst::ap::detail::ChunkManagerImpl< MutexT, DataT, TraitsT >::printChunks | ( | std::ostream & | os | ) | const |
Definition at line 924 of file ChunkManagerImpl.cc.
| void lsst::ap::detail::ChunkManagerImpl< MutexT, DataT, TraitsT >::printVisit | ( | int const | visitId, |
| std::ostream & | os | ||
| ) | const |
Definition at line 931 of file ChunkManagerImpl.cc.
| void lsst::ap::detail::ChunkManagerImpl< MutexT, DataT, TraitsT >::printVisits | ( | std::ostream & | os | ) | const |
Definition at line 917 of file ChunkManagerImpl.cc.
| void lsst::ap::detail::ChunkManagerImpl< MutexT, DataT, TraitsT >::registerVisit | ( | int const | visitId | ) |
Registers the given visit as in-flight without performing any further action.
| lsst::pex::exceptions::InvalidParameterError | Thrown if the given visit is already in-flight. |
| lsst::pex::exceptions::LengthError | Thrown if too-many visits are currently in-flight. |
Definition at line 738 of file ChunkManagerImpl.cc.
|
private |
Definition at line 905 of file ChunkManagerImpl.cc.
|
inlinestatic |
Returns the total number of bytes required for a ChunkManagerImpl instance and it's associated pool of memory blocks.
Definition at line 308 of file ChunkManagerImpl.h.
| void lsst::ap::detail::ChunkManagerImpl< MutexT, DataT, TraitsT >::startVisit | ( | std::vector< Chunk > & | toRead, |
| std::vector< Chunk > & | toWaitFor, | ||
| int const | visitId, | ||
| std::vector< int > const & | chunkIds | ||
| ) |
Begins visit processing by registering the given visit as an interested party of each chunk with identifier in the given list. If any identifier in the list does not have a corresponding chunk, a new chunk (owned by the specified visit) is created.
Note that the toWaitFor and toRead output vectors are cleared immediately on entry to the function. Under the assumption that these vectors are empty to begin with, strong exception safety is guaranteed.
| [out] | toRead | Set to the list of newly created chunks that must be read from disk. |
| [out] | toWaitFor | Set to the list of chunks that are already in memory and must be waited on. |
| [in] | visitId | The visit to begin. |
| [in] | chunkIds | Identifiers for chunks to register an interest in or create. |
| lsst::pex::exceptions::InvalidParameterError | Thrown if the given visit is not currently in-flight. |
| lsst::pex::exceptions::LengthError | Thrown if the chunk manager does not have space to track all the chunks for the visit. |
Definition at line 773 of file ChunkManagerImpl.cc.
| void lsst::ap::detail::ChunkManagerImpl< MutexT, DataT, TraitsT >::waitForOwnership | ( | std::vector< Chunk > & | toRead, |
| std::vector< Chunk > & | toWaitFor, | ||
| int const | visitId, | ||
| TimeSpec const & | deadline | ||
| ) |
Blocks the calling thread until the given visit owns every one of the given chunks.
Note that the vector toRead passed into the method is assumed to be empty - it is immediately cleared upon entry to the function.
| [out] | toRead | Set to the list of chunks acquired by the given visit, but which must be re-read from disk. |
| [in,out] | toWaitFor | The list of chunks that must be owned by the given visit before returning - acquired chunks are removed from the list, so that the list is empty on successfull return. |
| [in] | visitId | The visit that must wait for chunk ownership. |
| [in] | deadline | The point in time after which chunk acquisition should be abandoned. |
| lsst::pex::exceptions::TimeoutError | Thrown if the visit deadline expired while waiting to acquire chunks. |
Definition at line 820 of file ChunkManagerImpl.cc.
|
private |
Definition at line 350 of file ChunkManagerImpl.h.
|
mutableprivate |
Definition at line 347 of file ChunkManagerImpl.h.
|
private |
Definition at line 348 of file ChunkManagerImpl.h.
|
private |
Definition at line 349 of file ChunkManagerImpl.h.
1.8.5