PersistentEntitySegment Class Reference

The PersistentEntitySegment class is the base class for all memory segments containing memoryx::Entity instances to be stored permanently in MongoDB. More...

#include <MemoryX/core/memory/PersistentEntitySegment.h>

+ Inheritance diagram for PersistentEntitySegment:

Public Member Functions

std::string addEntity (const EntityBasePtr &entity, const ::Ice::Current &c=Ice::emptyCurrent) override
 addEntity add new entity and return the newly generated entity ID More...
 
EntityIdList addEntityList (const EntityBaseList &entityList, const Ice::Current &=Ice::emptyCurrent) override
 addEntityList adds all entities contained in \entityList to this segment and returns a list of created entity IDs More...
 
virtual EntityIdList addEntityListThreadUnsafe (const EntityBaseList &entityList)
 
virtual std::string addEntityThreadUnsafe (const EntityBasePtr &entity)
 
void addReadCollection (const CollectionInterfacePrx &coll, const ::Ice::Current &=Ice::emptyCurrent) override
 
void clear (const ::Ice::Current &=Ice::emptyCurrent) override
 clear removes all elements from the current memoryx::PersistentEntitySegment::writeCollection More...
 
void clearReadCollections (const ::Ice::Current &=Ice::emptyCurrent) override
 
EntityRefList findRefsByQuery (const std::string &query, const Ice::Current &c) override
 retrieves Entity Refs that match the query. More...
 
EntityBaseList getAllEntities (const ::Ice::Current &=Ice::emptyCurrent) const override
 getAllEntities returns a list of all entities managed by this memory segment More...
 
EntityIdList getAllEntityIds (const ::Ice::Current &=Ice::emptyCurrent) const override
 
virtual EntityIdList getAllEntityIdsThreadUnsafe () const
 
EntityBaseList getEntitiesByAttrValue (const ::std::string &attrName, const ::std::string &attrValue, const ::Ice::Current &=Ice::emptyCurrent) const override
 
EntityBaseList getEntitiesByAttrValueList (const ::std::string &attrName, const NameList &attrValueList, const ::Ice::Current &=Ice::emptyCurrent) const override
 
EntityBasePtr getEntityById (const ::std::string &entityId, const ::Ice::Current &=Ice::emptyCurrent) const override
 
virtual EntityBasePtr getEntityByIdThreadUnsafe (const ::std::string &entityId) const
 
EntityBasePtr getEntityByName (const ::std::string &name, const ::Ice::Current &=Ice::emptyCurrent) const override
 
virtual EntityBasePtr getEntityByNameThreadUnsafe (const ::std::string &name) const
 
EntityRefBasePtr getEntityRefById (const std::string &id, const Ice::Current &) const override
 
EntityRefBasePtr getEntityRefByName (const std::string &name, const Ice::Current &c) const override
 
::Ice::Identity getIceId (const ::Ice::Current &=Ice::emptyCurrent) const override
 
IdEntityMap getIdEntityMap (const ::Ice::Current &=Ice::emptyCurrent) const override
 
std::string getObjectTypeId (const ::Ice::Current &=Ice::emptyCurrent) const override
 
NameList getReadCollectionsNS (const ::Ice::Current &=Ice::emptyCurrent) const override
 
std::string getSegmentName (const ::Ice::Current &=Ice::emptyCurrent) const override
 
std::string getWriteCollectionNS (const ::Ice::Current &=Ice::emptyCurrent) const override
 
bool hasEntityById (const std::string &entityId, const Ice::Current &=Ice::emptyCurrent) const override
 
bool hasEntityByIdThreadUnsafe (const std::string &entityId) const
 
bool hasEntityByName (const std::string &entityName, const Ice::Current &=Ice::emptyCurrent) const override
 
bool hasEntityByNameThreadUnsafe (const std::string &entityName) const
 
 PersistentEntitySegment (CollectionInterfacePrx entityCollection, Ice::CommunicatorPtr ic, bool useMongoIds=true)
 
void print (const ::Ice::Current &=Ice::emptyCurrent) const override
 
void removeAllEntities (const ::Ice::Current &c=Ice::emptyCurrent) override
 removeAllEntities collects all entities managed by this memory segment and removes them from the segment More...
 
void removeEntity (const ::std::string &entityId, const ::Ice::Current &=Ice::emptyCurrent) override
 removeEntity removes an entity with the ID entityId More...
 
virtual void removeEntityThreadUnsafe (const ::std::string &entityId)
 
void setEntityAttribute (const std::string &entityId, const EntityAttributeBasePtr &attribute, const Ice::Current &) override
 
void setEntityAttributes (const std::string &entityId, const EntityAttributeList &attributeMap, const Ice::Current &) override
 
void setParentMemory (const MemoryInterfacePtr &memory, const Ice::Current &) override
 
void setSingleRWCollection (const CollectionInterfacePrx &coll, const ::Ice::Current &=Ice::emptyCurrent) override
 
void setWriteCollection (const CollectionInterfacePrx &coll, const ::Ice::Current &=Ice::emptyCurrent) override
 
Ice::Int size (const ::Ice::Current &=Ice::emptyCurrent) const override
 size counts the number of memoryx::Entity instances contained available reachable throuhg memoryx::PersistentEntitySegment::readCollections. More...
 
void updateEntity (const ::std::string &entityId, const EntityBasePtr &update, const ::Ice::Current &=Ice::emptyCurrent) override
 
virtual void updateEntityThreadUnsafe (const ::std::string &entityId, const EntityBasePtr &update)
 
std::string upsertEntity (const std::string &entityId, const EntityBasePtr &entity, const ::Ice::Current &=Ice::emptyCurrent) override
 
std::string upsertEntityByName (const std::string &entityName, const EntityBasePtr &entity, const ::Ice::Current &=Ice::emptyCurrent) override
 
virtual std::string upsertEntityByNameThreadUnsafe (const std::string &entityName, const EntityBasePtr &entity)
 
EntityIdList upsertEntityList (const EntityBaseList &entityList, const Ice::Current &=Ice::emptyCurrent) override
 
virtual EntityIdList upsertEntityListThreadUnsafe (const EntityBaseList &entityList)
 
virtual std::string upsertEntityThreadUnsafe (const std::string &entityId, const EntityBasePtr &entity)
 
 ~PersistentEntitySegment () override
 
- Public Member Functions inherited from SegmentUtilImplementations
EntityBaseList getEntityWithChildrenById (const std::string &id, bool includeMetaEntities, const Ice::Current &c=Ice::emptyCurrent) const override
 
EntityBaseList getEntityWithChildrenByName (const std::string &, bool includeMetaEntities, const Ice::Current &c=Ice::emptyCurrent) const override
 
std::string getJSONEntityById (const std::string &id, const Ice::Current &) const override
 
ScopedSharedLockPtr getReadLock (const Ice::Current &c) const
 
ScopedUniqueLockPtr getWriteLock (const Ice::Current &c) const
 
bool keepLockAlive (const std::string &token, const Ice::Current &) override
 
SegmentLockBasePtr lockSegment (const Ice::Current &c) override
 
 SegmentUtilImplementations ()
 
bool unlockSegment (const SegmentLockBasePtr &lock, const Ice::Current &c) override
 
bool unlockSegmentWithToken (const std::string &token, const Ice::Current &c) override
 

Protected Member Functions

EntityBasePtr deserializeEntity (const DBStorableData &dbEntity) const
 
void setSegmentName (const std::string &segmentName, const ::Ice::Current &=Ice::emptyCurrent) override
 
- Protected Member Functions inherited from SegmentUtilImplementations
void keepAliveCheck ()
 

Protected Attributes

MongoSerializerPtr dbSerializer
 
std::recursive_mutex dbSerializerMutex
 
MemoryInterfacePtr parentMemory
 
CollectionPrxList readCollections
 
std::string segmentName
 
bool useMongoIds
 
CollectionInterfacePrx writeCollection
 
- Protected Attributes inherited from SegmentUtilImplementations
armarx::PeriodicTask< SegmentUtilImplementations >::pointer_type keepAliveCheckTask
 
IceUtil::Time keepAliveTimestamp
 
std::mutex keepAliveTimestampMutex
 
std::string lockToken
 
std::mutex mutex
 
ScopedSharedLockPtr readLock
 
std::shared_mutex segmentMutex
 
EntityMemorySegmentInterfacePrx selfProxy
 
std::mutex tokenMutex
 
ScopedUniqueLockPtr writeLock
 

Additional Inherited Members

- Public Types inherited from SegmentUtilImplementations
using ScopedSharedLock = std::unique_lock< std::shared_mutex >
 
using ScopedSharedLockPtr = std::unique_ptr< ScopedSharedLock >
 
using ScopedUniqueLock = std::unique_lock< std::shared_mutex >
 
using ScopedUniqueLockPtr = std::unique_ptr< ScopedSharedLock >
 

Detailed Description

The PersistentEntitySegment class is the base class for all memory segments containing memoryx::Entity instances to be stored permanently in MongoDB.

Definition at line 107 of file PersistentEntitySegment.h.

Constructor & Destructor Documentation

◆ PersistentEntitySegment()

PersistentEntitySegment ( CollectionInterfacePrx  entityCollection,
Ice::CommunicatorPtr  ic,
bool  useMongoIds = true 
)

Definition at line 41 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:

◆ ~PersistentEntitySegment()

~PersistentEntitySegment ( )
override

Definition at line 49 of file PersistentEntitySegment.cpp.

Member Function Documentation

◆ addEntity()

std::string addEntity ( const EntityBasePtr &  entity,
const ::Ice::Current &  c = Ice::emptyCurrent 
)
override

addEntity add new entity and return the newly generated entity ID

Parameters
entity
Returns

Definition at line 135 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addEntityList()

EntityIdList addEntityList ( const EntityBaseList &  entityList,
const Ice::Current &  c = Ice::emptyCurrent 
)
override

addEntityList adds all entities contained in \entityList to this segment and returns a list of created entity IDs

Returns
list of generated entity IDs

Definition at line 221 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:

◆ addEntityListThreadUnsafe()

EntityIdList addEntityListThreadUnsafe ( const EntityBaseList &  entityList)
virtual

Definition at line 227 of file PersistentEntitySegment.cpp.

+ Here is the caller graph for this function:

◆ addEntityThreadUnsafe()

std::string addEntityThreadUnsafe ( const EntityBasePtr &  entity)
virtual

Definition at line 142 of file PersistentEntitySegment.cpp.

+ Here is the caller graph for this function:

◆ addReadCollection()

void addReadCollection ( const CollectionInterfacePrx &  coll,
const ::Ice::Current &  c = Ice::emptyCurrent 
)
override

Definition at line 78 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clear()

void clear ( const ::Ice::Current &  c = Ice::emptyCurrent)
override

clear removes all elements from the current memoryx::PersistentEntitySegment::writeCollection

Definition at line 513 of file PersistentEntitySegment.cpp.

◆ clearReadCollections()

void clearReadCollections ( const ::Ice::Current &  c = Ice::emptyCurrent)
override

Definition at line 71 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deserializeEntity()

EntityBasePtr deserializeEntity ( const DBStorableData &  dbEntity) const
protected

Definition at line 592 of file PersistentEntitySegment.cpp.

+ Here is the caller graph for this function:

◆ findRefsByQuery()

EntityRefList findRefsByQuery ( const std::string &  query,
const Ice::Current &  c 
)
override

retrieves Entity Refs that match the query.

The query should be a mongo query like: { "attrs.endNode.value.value.entityId": "54b2a43b43b5d3199e3cb5b3" }

Parameters
query
c
Returns

Definition at line 702 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:

◆ getAllEntities()

EntityBaseList getAllEntities ( const ::Ice::Current &  c = Ice::emptyCurrent) const
override

getAllEntities returns a list of all entities managed by this memory segment

Returns

Definition at line 554 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAllEntityIds()

EntityIdList getAllEntityIds ( const ::Ice::Current &  c = Ice::emptyCurrent) const
override

Definition at line 530 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAllEntityIdsThreadUnsafe()

EntityIdList getAllEntityIdsThreadUnsafe ( ) const
virtual

Definition at line 536 of file PersistentEntitySegment.cpp.

+ Here is the caller graph for this function:

◆ getEntitiesByAttrValue()

EntityBaseList getEntitiesByAttrValue ( const ::std::string &  attrName,
const ::std::string &  attrValue,
const ::Ice::Current &  c = Ice::emptyCurrent 
) const
override

Definition at line 427 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEntitiesByAttrValueList()

EntityBaseList getEntitiesByAttrValueList ( const ::std::string &  attrName,
const NameList &  attrValueList,
const ::Ice::Current &  c = Ice::emptyCurrent 
) const
override

Definition at line 457 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:

◆ getEntityById()

EntityBasePtr getEntityById ( const ::std::string &  entityId,
const ::Ice::Current &  c = Ice::emptyCurrent 
) const
override

Definition at line 363 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEntityByIdThreadUnsafe()

EntityBasePtr getEntityByIdThreadUnsafe ( const ::std::string &  entityId) const
virtual

Definition at line 371 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEntityByName()

EntityBasePtr getEntityByName ( const ::std::string &  name,
const ::Ice::Current &  c = Ice::emptyCurrent 
) const
override

Definition at line 399 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEntityByNameThreadUnsafe()

EntityBasePtr getEntityByNameThreadUnsafe ( const ::std::string &  name) const
virtual

Definition at line 406 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEntityRefById()

EntityRefBasePtr getEntityRefById ( const std::string &  id,
const Ice::Current &  c 
) const
override

Definition at line 612 of file PersistentEntitySegment.cpp.

◆ getEntityRefByName()

EntityRefBasePtr getEntityRefByName ( const std::string &  name,
const Ice::Current &  c 
) const
override

Definition at line 633 of file PersistentEntitySegment.cpp.

◆ getIceId()

Ice::Identity getIceId ( const ::Ice::Current &  = Ice::emptyCurrent) const
override

Definition at line 518 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getIdEntityMap()

IdEntityMap getIdEntityMap ( const ::Ice::Current &  c = Ice::emptyCurrent) const
override

Definition at line 580 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:

◆ getObjectTypeId()

std::string getObjectTypeId ( const ::Ice::Current &  c = Ice::emptyCurrent) const
override

Definition at line 130 of file PersistentEntitySegment.cpp.

◆ getReadCollectionsNS()

NameList getReadCollectionsNS ( const ::Ice::Current &  c = Ice::emptyCurrent) const
override

Definition at line 53 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:

◆ getSegmentName()

std::string getSegmentName ( const ::Ice::Current &  = Ice::emptyCurrent) const
override

Definition at line 525 of file PersistentEntitySegment.cpp.

◆ getWriteCollectionNS()

std::string getWriteCollectionNS ( const ::Ice::Current &  c = Ice::emptyCurrent) const
override

Definition at line 110 of file PersistentEntitySegment.cpp.

◆ hasEntityById()

bool hasEntityById ( const std::string &  entityId,
const Ice::Current &  c = Ice::emptyCurrent 
) const
override

Definition at line 295 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:

◆ hasEntityByIdThreadUnsafe()

bool hasEntityByIdThreadUnsafe ( const std::string &  entityId) const

Definition at line 301 of file PersistentEntitySegment.cpp.

+ Here is the caller graph for this function:

◆ hasEntityByName()

bool hasEntityByName ( const std::string &  entityName,
const Ice::Current &  c = Ice::emptyCurrent 
) const
override

Definition at line 334 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:

◆ hasEntityByNameThreadUnsafe()

bool hasEntityByNameThreadUnsafe ( const std::string &  entityName) const

Definition at line 340 of file PersistentEntitySegment.cpp.

+ Here is the caller graph for this function:

◆ print()

void print ( const ::Ice::Current &  c = Ice::emptyCurrent) const
override

Definition at line 507 of file PersistentEntitySegment.cpp.

◆ removeAllEntities()

void removeAllEntities ( const ::Ice::Current &  c = Ice::emptyCurrent)
override

removeAllEntities collects all entities managed by this memory segment and removes them from the segment

Parameters
c

Definition at line 283 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:

◆ removeEntity()

void removeEntity ( const ::std::string &  entityId,
const ::Ice::Current &  c = Ice::emptyCurrent 
)
override

removeEntity removes an entity with the ID entityId

Parameters
entityId

Definition at line 263 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:

◆ removeEntityThreadUnsafe()

void removeEntityThreadUnsafe ( const ::std::string &  entityId)
virtual

Definition at line 270 of file PersistentEntitySegment.cpp.

+ Here is the caller graph for this function:

◆ setEntityAttribute()

void setEntityAttribute ( const std::string &  entityId,
const EntityAttributeBasePtr &  attribute,
const Ice::Current &  c 
)
override

Definition at line 656 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:

◆ setEntityAttributes()

void setEntityAttributes ( const std::string &  entityId,
const EntityAttributeList &  attributeMap,
const Ice::Current &  c 
)
override

Definition at line 674 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:

◆ setParentMemory()

void setParentMemory ( const MemoryInterfacePtr &  memory,
const Ice::Current &   
)
override

Definition at line 697 of file PersistentEntitySegment.cpp.

◆ setSegmentName()

void setSegmentName ( const std::string &  segmentName,
const ::Ice::Current &  = Ice::emptyCurrent 
)
overrideprotected

Definition at line 741 of file PersistentEntitySegment.cpp.

◆ setSingleRWCollection()

void setSingleRWCollection ( const CollectionInterfacePrx &  coll,
const ::Ice::Current &  c = Ice::emptyCurrent 
)
override

Definition at line 123 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setWriteCollection()

void setWriteCollection ( const CollectionInterfacePrx &  coll,
const ::Ice::Current &  c = Ice::emptyCurrent 
)
override

Definition at line 115 of file PersistentEntitySegment.cpp.

+ Here is the caller graph for this function:

◆ size()

Ice::Int size ( const ::Ice::Current &  c = Ice::emptyCurrent) const
override

size counts the number of memoryx::Entity instances contained available reachable throuhg memoryx::PersistentEntitySegment::readCollections.

Returns
number of entities contained in this memory segment

Definition at line 489 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:

◆ updateEntity()

void updateEntity ( const ::std::string &  entityId,
const EntityBasePtr &  update,
const ::Ice::Current &  c = Ice::emptyCurrent 
)
override

Definition at line 244 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateEntityThreadUnsafe()

void updateEntityThreadUnsafe ( const ::std::string &  entityId,
const EntityBasePtr &  update 
)
virtual

Definition at line 250 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ upsertEntity()

std::string upsertEntity ( const std::string &  entityId,
const EntityBasePtr &  entity,
const ::Ice::Current &  = Ice::emptyCurrent 
)
override

Definition at line 153 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:

◆ upsertEntityByName()

std::string upsertEntityByName ( const std::string &  entityName,
const EntityBasePtr &  entity,
const ::Ice::Current &  = Ice::emptyCurrent 
)
override

Definition at line 199 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:

◆ upsertEntityByNameThreadUnsafe()

std::string upsertEntityByNameThreadUnsafe ( const std::string &  entityName,
const EntityBasePtr &  entity 
)
virtual

Definition at line 205 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ upsertEntityList()

EntityIdList upsertEntityList ( const EntityBaseList &  entityList,
const Ice::Current &  c = Ice::emptyCurrent 
)
override

Definition at line 173 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:

◆ upsertEntityListThreadUnsafe()

EntityIdList upsertEntityListThreadUnsafe ( const EntityBaseList &  entityList)
virtual

Definition at line 179 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ upsertEntityThreadUnsafe()

std::string upsertEntityThreadUnsafe ( const std::string &  entityId,
const EntityBasePtr &  entity 
)
virtual

Definition at line 159 of file PersistentEntitySegment.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ dbSerializer

MongoSerializerPtr dbSerializer
protected

Definition at line 227 of file PersistentEntitySegment.h.

◆ dbSerializerMutex

std::recursive_mutex dbSerializerMutex
mutableprotected

Definition at line 228 of file PersistentEntitySegment.h.

◆ parentMemory

MemoryInterfacePtr parentMemory
protected

Definition at line 221 of file PersistentEntitySegment.h.

◆ readCollections

CollectionPrxList readCollections
protected

Definition at line 223 of file PersistentEntitySegment.h.

◆ segmentName

std::string segmentName
protected

Definition at line 233 of file PersistentEntitySegment.h.

◆ useMongoIds

bool useMongoIds
protected

Definition at line 230 of file PersistentEntitySegment.h.

◆ writeCollection

CollectionInterfacePrx writeCollection
protected

Definition at line 226 of file PersistentEntitySegment.h.


The documentation for this class was generated from the following files: