Panda3D

Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
ClientRepositoryBase Class Reference
Inheritance diagram for ClientRepositoryBase:

## Public Member Functions
| __init__ (self, dcFileNames=None, dcSuffix='', connectMethod=None, threadedNet=None)
| allocateContext (self)
| considerHeartbeat (self)
| disableDoId (self, doId, ownerView=False)
| doDeferredGenerate (self, task)
| doGenerate (self, parentId, zoneId, classId, doId, di)
| flushGenerates (self)
| generateWithRequiredFields (self, dclass, doId, di, parentId, zoneId)
| generateWithRequiredOtherFields (self, dclass, doId, di, parentId=None, zoneId=None)
| generateWithRequiredOtherFieldsOwner (self, dclass, doId, di)
| getObjectsOfClass (self, objClass)
| getObjectsOfExactClass (self, objClass)
| getServerDelta (self)
| getServerTimeOfDay (self)
| getTables (self, ownerView)
| getWorld (self, doId)
| handleDelete (self, di)
| handleGoGetLost (self, di)
| handleServerHeartbeat (self, di)
| handleSystemMessage (self, di)
| handleSystemMessageAknowledge (self, di)
| handleUpdateField (self, di)
| isLive (self)
| isLocalId (self, id)
| printDelayDeletes (self)
| replaceMethod (self, oldMethod, newFunction)
| replayDeferredGenerate (self, msgType, extra)
| sendHeartbeatTask (self, task)
| setDeferInterval (self, deferInterval)
| setServerDelta (self, delta)
| specialName (self, label)
| def queryObjectAll(self, doID, context=0): """ Get a one-time snapshot look at the object.
| startHeartbeat (self)
| stopHeartbeat (self)
| waitForNextHeartBeat (self)
Public Member Functions inherited from ConnectionRepository
| __init__ (self, connectMethod, config, hasOwnerView=False, threadedNet=None)
| checkHttp (self)
| connect (self, serverList, successCallback=None, successArgs=[], failureCallback=None, failureArgs=[])
| disconnect (self)
| generateGlobalObject (self, doId, dcname, values=None)
| getServerAddress (self)
| handleDatagram (self, di)
| handleReaderOverflow (self)
| httpConnectCallback (self, ch, serverList, serverIndex, successCallback, successArgs, failureCallback, failureArgs)
| importModule (self, dcImports, moduleName, importSymbols)
| lostConnection (self)
| readDCFile (self, dcFileNames=None)
| readerPollOnce (self)
| readerPollUntilEmpty (self, task)
| send (self, datagram)
| shutdown (self)
| startReaderPollTask (self)
| stopReaderPollTask (self)
Public Member Functions inherited from DoInterestManager
| __init__ (self)
| addAutoInterest (self, parentId, zoneIdList, description)
| addInterest (self, parentId, zoneIdList, description, event=None)
| alterInterest (self, handle, parentId, zoneIdList, description=None, event=None)
| cleanupWaitAllInterestsComplete (self)
| closeAutoInterests (self, obj)
| getAllInterestsCompleteEvent (self)
| handleInterestDoneMessage (self, di)
| isValidInterestHandle (self, handle)
| noNewInterests (self)
| openAutoInterests (self, obj)
| printInterestHistory (self)
| printInterests (self)
| printInterestSets (self)
| printInterestsIfDebug (self)
| queueAllInterestsCompleteEvent (self, frames=5)
| removeAIInterest (self, handle)
| removeAutoInterest (self, handle)
| removeInterest (self, handle, event=None)
| resetInterestStateForConnectionLoss (self)
| setAllInterestsCompleteCallback (self, callback)
| setNoNewInterests (self, flag)
| updateInterestDescription (self, handle, desc)
Public Member Functions inherited from DirectObject
| __init__ (self)
| accept (self, event, method, extraArgs=[])
| acceptOnce (self, event, method, extraArgs=[])
| addTask (self, *args, **kwargs)
| detectLeaks (self)
| doMethodLater (self, *args, **kwargs)
| getAllAccepting (self)
| ignore (self, event)
| ignoreAll (self)
| isAccepting (self, event)
| isIgnoring (self, event)
| removeAllTasks (self)
| removeTask (self, taskOrName)
Public Member Functions inherited from DoCollectionManager
| __init__ (self)
| addDOToTables (self, do, location=None, ownerView=False)
| callbackWithDo (self, doId, callback)
| callbackWithOwnerView (self, doId, callback)
| countObjects (self, classType)
| deleteDistributedObjects (self)
| deleteObjectLocation (self, object, parentId, zoneId)
| doByDistance (self)
| doFind (self, str)
| doFindAll (self, str)
| doFindAllInstances (self, cls)
| doFindAllMatching (self, str)
| doFindAllOfType (self, query)
| dosByDistance (self)
| findAnyOfType (self, type)
| getAllOfType (self, type)
| getDo (self, doId)
| getDoIdList (self, parentId, zoneId=None, classType=None)
| getDoList (self, parentId, zoneId=None, classType=None)
| getDoTable (self, ownerView)
| getGameDoId (self)
| getObjectsInZone (self, parentId, zoneId)
| def changeDOZoneInTables(self, do, newParentId, newZoneId, oldParentId, oldZoneId): if 1: self.storeObjectLocation(do.doId, newParentId, newZoneId) else: #assert not hasattr(do, "isQueryAllResponse") or not do.isQueryAllResponse oldLocation = (oldParentId, oldZoneId) newLocation = (newParentId, newZoneId)
| getObjectsOfClassInZone (self, parentId, zoneId, objClass)
| getOwnerView (self, doId)
| getOwnerViewDoIdList (self, classType)
| getOwnerViewDoList (self, classType)
| handleObjectLocation (self, di)
| handleSetLocation (self, di)
| hasOwnerViewDoId (self, doId)
| isInDoTables (self, doId)
| isValidLocationTuple (self, location)
| printObjectCount (self)
| printObjects (self)
| removeDOFromTables (self, do)
| storeObjectLocation (self, object, parentId, zoneId)
| webPrintObjectCount (self)

## Public Attributes
| cache = CRCache.CRCache()
| cacheOwner = CRCache.CRCache()
int | context = 100000
int | deferInterval = deferInterval
dict | deferredDoIds = {}
list | deferredGenerates = []
| doDataCache = CRDataCache()
| doDeferredGenerate
| heartbeatInterval = base.config.GetDouble('heartbeat-interval', 10)
int | heartbeatStarted = 0
int | lastGenerate = 0
int | lastHeartbeat = 0
bool | noDefer = False
| parentMgr = ParentMgr.ParentMgr()
| relatedObjectMgr = RelatedObjectMgr.RelatedObjectMgr(self)
| sendHeartbeatTask
int | serverDelta = 0
int | specialNameNumber = 0
| timeManager = None
Public Attributes inherited from ConnectionRepository
| bootedIndex = None
| bootedText = None
| config = config
| connectHttp = None
int | connectMethod = connectMethod
dict | dclassesByName = {}
dict | dclassesByNumber = {}
str | dcSuffix = ''
| handleReaderOverflow
int | hashVal = 0
| http = None
| lostConnection
| private__di = PyDatagramIterator()
| readerPollTaskObj = None
| recorder = None
| uniqueId = hash(self)
Public Attributes inherited from DoCollectionManager
dict | doId2do = {}
| location = do.getLocation() if location is not None: if location not in self.zoneId2doIds: self.notify.warning( 'dobj s (s) has invalid location: s' % (do, do.doId, location)) else: assert do.doId in self.zoneId2doIds[location] del self.zoneId2doIds[location][do.doId] if len(self.zoneId2doIds[location]) == 0: del self.zoneId2doIds[location]
dict | doId2ownerView = {}
| self.zoneId2doIds={}
| getDo

## Protected Member Functions
| _addDelayDeletedDO (self, do)
| _getMsgName (self, msgId)
| _logFailedDisable (self, doId, ownerView)
| _removeDelayDeletedDO (self, do)
Protected Member Functions inherited from ConnectionRepository
| _adjustGcThreshold (self, task)
| _garbageCollect (self, task=None)
| _getLostConnectionEvent (self)
Protected Member Functions inherited from DoInterestManager
| _addDebugInterestHistory (self, action, description, handle, contextId, parentId, zoneIdList)
| _considerRemoveInterest (self, handle)
| _getAddInterestEvent (self)
| _getAnonymousEvent (self, desc)
| _getInterestState (self, handle)
| _getNextContextId (self)
| _getNextHandle (self)
| _getRemoveInterestEvent (self)
| _sendAddInterest (self, handle, contextId, parentId, zoneIdList, description, action=None)
| _sendRemoveAIInterest (self, handle)
| _sendRemoveInterest (self, handle, contextId)
Protected Member Functions inherited from DirectObject
| _addTask (self, task)
| _clearTask (self, task)
Protected Member Functions inherited from DoCollectionManager
| _compareDistance (self, do1, do2)
| _getDistanceFromLA (self, do)
| _printObjects (self, table)
| _returnObjects (self, table)

## Protected Attributes
dict | _delayDeletedDOs = {}
Protected Attributes inherited from ConnectionRepository
| _adjustGcThreshold
| _garbageCollect
| _gcDefaultThreshold = gc.get_threshold()
str | _serverAddress = ''
Protected Attributes inherited from DoInterestManager
| _addInterestEvent = uniqueName('DoInterestManager-Add')
list | _allInterestsCompleteCallbacks = []
| _completeDelayedCallback = None
| _completeEventCount = ScratchPad(num=0)
bool | _noNewInterests = False
| _removeInterestEvent = uniqueName('DoInterestManager-Remove')
Protected Attributes inherited from DirectObject
dict | _taskList = {}
Protected Attributes inherited from DoCollectionManager
| _doHierarchy = DoHierarchy.DoHierarchy()

## Additional Inherited Members
Static Public Attributes inherited from ConnectionRepository
int | CM_HTTP = 0
int | CM_NATIVE = 2
int | CM_NET = 1
str | GarbageCollectTaskName = "allowGarbageCollect"
str | GarbageThresholdTaskName = "adjustGarbageCollectThreshold"
| gcNotify = directNotify.newCategory("GarbageCollect")
| taskChain = None
int | taskPriority = -30
Static Public Attributes inherited from DoInterestManager
| InterestDebug = ConfigVariableBool('interest-debug', False)
| notify = directNotify.newCategory("DoInterestManager")
Static Public Attributes inherited from DirectObject
| accept_once = acceptOnce
| add_task = addTask
| detect_leaks = detectLeaks
| do_method_later = doMethodLater
| get_all_accepting = getAllAccepting
| ignore_all = ignoreAll
| is_accepting = isAccepting
| is_ignoring = isIgnoring
| remove_all_tasks = removeAllTasks
| remove_task = removeTask
Static Protected Attributes inherited from DoInterestManager
int | _ContextIdMask = 0x3FFFFFFF
int | _ContextIdSerialNum = 100
list | _debug_interestHistory = []
int | _debug_maxDescriptionLen = 40
int | _HandleMask = 0x7FFF
int | _HandleSerialNum = 0
dict | _interests = {}
| _SerialGen = SerialNumGen()
| _SerialNum = serialNum()

## Detailed Description

    This maintains a client-side connection with a Panda server.

    This base class exists to collect the common code between
    ClientRepository, which is the CMU-provided, open-source version
    of the client repository code, and OTPClientRepository, which is
    the VR Studio's implementation of the same.

## Constructor & Destructor Documentation

## ◆ __init__()

__init__ | ( |  | self,
|  |  | dcFileNames = None,
|  |  | dcSuffix = '',
|  |  | connectMethod = None,
|  |  | threadedNet = None )

## Member Function Documentation

## ◆ _addDelayDeletedDO()

_addDelayDeletedDO | ( |  | self,
|  |  | do )
| protected

## ◆ _getMsgName()

_getMsgName | ( |  | self,
|  |  | msgId )
| protected

## ◆ _logFailedDisable()

_logFailedDisable | ( |  | self,
|  |  | doId,
|  |  | ownerView )
| protected

## ◆ _removeDelayDeletedDO()

_removeDelayDeletedDO | ( |  | self,
|  |  | do )
| protected

## ◆ allocateContext()

allocateContext | ( |  | self | ) |

## ◆ considerHeartbeat()

considerHeartbeat | ( |  | self | ) |

    Send a heartbeat message if we haven't sent one recently.

## ◆ disableDoId()

disableDoId | ( |  | self,
|  |  | doId,
|  |  | ownerView = False )

## ◆ doDeferredGenerate()

doDeferredGenerate | ( |  | self,
|  |  | task )

     This is the task that generates an object on the deferred
    queue.

## ◆ doGenerate()

doGenerate | ( |  | self,
|  |  | parentId,
|  |  | zoneId,
|  |  | classId,
|  |  | doId,
|  |  | di )

## ◆ flushGenerates()

flushGenerates | ( |  | self | ) |

     Forces all pending generates to be performed immediately.

## ◆ generateWithRequiredFields()

generateWithRequiredFields | ( |  | self,
|  |  | dclass,
|  |  | doId,
|  |  | di,
|  |  | parentId,
|  |  | zoneId )

## ◆ generateWithRequiredOtherFields()

generateWithRequiredOtherFields | ( |  | self,
|  |  | dclass,
|  |  | doId,
|  |  | di,
|  |  | parentId = None,
|  |  | zoneId = None )

## ◆ generateWithRequiredOtherFieldsOwner()

generateWithRequiredOtherFieldsOwner | ( |  | self,
|  |  | dclass,
|  |  | doId,
|  |  | di )

## ◆ getObjectsOfClass()

getObjectsOfClass | ( |  | self,
|  |  | objClass )

     returns dict of doId:object, containing all objects
    that inherit from 'class'. returned dict is safely mutable.

## ◆ getObjectsOfExactClass()

getObjectsOfExactClass | ( |  | self,
|  |  | objClass )

     returns dict of doId:object, containing all objects that
    are exactly of type 'class' (neglecting inheritance). returned
    dict is safely mutable.

## ◆ getServerDelta()

getServerDelta | ( |  | self | ) |

## ◆ getServerTimeOfDay()

getServerTimeOfDay | ( |  | self | ) |

    Returns the current time of day (seconds elapsed since the
    1972 epoch) according to the server's clock.  This is in GMT,
    and hence is irrespective of timezones.

    The value is computed based on the client's clock and the
    known delta from the server's clock, which is not terribly
    precisely measured and may drift slightly after startup, but
    it should be accurate plus or minus a couple of seconds.

## ◆ getTables()

getTables | ( |  | self,
|  |  | ownerView )

## ◆ getWorld()

getWorld | ( |  | self,
|  |  | doId )

## ◆ handleDelete()

handleDelete | ( |  | self,
|  |  | di )

Reimplemented in ClientRepository.

## ◆ handleGoGetLost()

handleGoGetLost | ( |  | self,
|  |  | di )

## ◆ handleServerHeartbeat()

handleServerHeartbeat | ( |  | self,
|  |  | di )

## ◆ handleSystemMessage()

handleSystemMessage | ( |  | self,
|  |  | di )

## ◆ handleSystemMessageAknowledge()

handleSystemMessageAknowledge | ( |  | self,
|  |  | di )

## ◆ handleUpdateField()

handleUpdateField | ( |  | self,
|  |  | di )

    This method is called when a CLIENT_OBJECT_UPDATE_FIELD
    message is received; it decodes the update, unpacks the
    arguments, and calls the corresponding method on the indicated
    DistributedObject.

    In fact, this method is exactly duplicated by the C++ method
    cConnectionRepository::handle_update_field(), which was
    written to optimize the message loop by handling all of the
    CLIENT_OBJECT_UPDATE_FIELD messages in C++.  That means that
    nowadays, this Python method will probably never be called,
    since UPDATE_FIELD messages will not even be passed to the
    Python message handlers.  But this method remains for
    documentation purposes, and also as a "just in case" handler
    in case we ever do come across a situation in the future in
    which python might handle the UPDATE_FIELD message.

Reimplemented in ClientRepository.

## ◆ isLive()

isLive | ( |  | self | ) |

## ◆ isLocalId()

isLocalId | ( |  | self,
|  |  | id )

Reimplemented in ClientRepository.

## ◆ printDelayDeletes()

printDelayDeletes | ( |  | self | ) |

## ◆ replaceMethod()

replaceMethod | ( |  | self,
|  |  | oldMethod,
|  |  | newFunction )

## ◆ replayDeferredGenerate()

replayDeferredGenerate | ( |  | self,
|  |  | msgType,
|  |  | extra )

     Override this to do something appropriate with deferred
    "generate" messages when they are replayed().

## ◆ sendHeartbeatTask()

sendHeartbeatTask | ( |  | self,
|  |  | task )

## ◆ setDeferInterval()

setDeferInterval | ( |  | self,
|  |  | deferInterval )

    Specifies the minimum amount of time, in seconds, that must
    elapse before generating any two DistributedObjects whose
    class type is marked "deferrable".  Set this to 0 to indicate
    no deferring will occur.

## ◆ setServerDelta()

setServerDelta | ( |  | self,
|  |  | delta )

    Indicates the approximate difference in seconds between the
    client's clock and the server's clock, in universal time (not
    including timezone shifts).  This is mainly useful for
    reporting synchronization information to the logs; don't
    depend on it for any precise timing requirements.

    Also see Notify.setServerDelta(), which also accounts for a
    timezone shift.

## ◆ specialName()

specialName | ( |  | self,
|  |  | label )

def queryObjectAll(self, doID, context=0): """ Get a one-time snapshot look at the object.

""" assert self.notify.debugStateCall(self)

# Create a message

datagram = PyDatagram() datagram.addServerHeader( doID, localAvatar.getDoId(), 2020)

# A context that can be used to index the response if needed

datagram.addUint32(context) self.send(datagram)

# Make sure the message gets there.

self.flush()

## ◆ startHeartbeat()

startHeartbeat | ( |  | self | ) |

## ◆ stopHeartbeat()

stopHeartbeat | ( |  | self | ) |

## ◆ waitForNextHeartBeat()

waitForNextHeartBeat | ( |  | self | ) |

## Member Data Documentation

## ◆ _delayDeletedDOs

dict _delayDeletedDOs = {}
| protected

## ◆ cache

cache = CRCache.CRCache()

## ◆ cacheOwner

cacheOwner = CRCache.CRCache()

## ◆ context

int context = 100000

## ◆ deferInterval

deferInterval = deferInterval

## ◆ deferredDoIds

dict deferredDoIds = {}

## ◆ deferredGenerates

deferredGenerates = []

## ◆ doDataCache

doDataCache = CRDataCache()

## ◆ doDeferredGenerate

doDeferredGenerate

## ◆ heartbeatInterval

heartbeatInterval = base.config.GetDouble('heartbeat-interval', 10)

## ◆ heartbeatStarted

int heartbeatStarted = 0

## ◆ lastGenerate

int lastGenerate = 0

## ◆ lastHeartbeat

int lastHeartbeat = 0

## ◆ noDefer

bool noDefer = False

## ◆ parentMgr

parentMgr = ParentMgr.ParentMgr()

## ◆ relatedObjectMgr

relatedObjectMgr = RelatedObjectMgr.RelatedObjectMgr(self)

## ◆ sendHeartbeatTask

sendHeartbeatTask

## ◆ serverDelta

int serverDelta = 0

## ◆ specialNameNumber

int specialNameNumber = 0

## ◆ timeManager

timeManager = None