Panda3D
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
ClientRepositoryBase Class Reference
Inheritance diagram for ClientRepositoryBase:
ConnectionRepository DoInterestManager DoCollectionManager ClientRepository OldClientRepository

Public Member Functions

def __init__ (self, dcFileNames=None, dcSuffix='', connectMethod=None, threadedNet=None)
 
def allocateContext (self)
 
def considerHeartbeat (self)
 
def disableDoId (self, doId, ownerView=False)
 
def doDeferredGenerate (self, task)
 
def doGenerate (self, parentId, zoneId, classId, doId, di)
 
def flushGenerates (self)
 
def generateWithRequiredFields (self, dclass, doId, di, parentId, zoneId)
 
def generateWithRequiredOtherFields (self, dclass, doId, di, parentId=None, zoneId=None)
 
def generateWithRequiredOtherFieldsOwner (self, dclass, doId, di)
 
def getObjectsOfClass (self, objClass)
 
def getObjectsOfExactClass (self, objClass)
 
def getServerDelta (self)
 
def getServerTimeOfDay (self)
 
def getTables (self, ownerView)
 
def getWorld (self, doId)
 
def handleDelete (self, di)
 
def handleGoGetLost (self, di)
 
def handleServerHeartbeat (self, di)
 
def handleSystemMessage (self, di)
 
def handleSystemMessageAknowledge (self, di)
 
def handleUpdateField (self, di)
 
def isLive (self)
 
def isLocalId (self, id)
 
def printDelayDeletes (self)
 
def replaceMethod (self, oldMethod, newFunction)
 
def replayDeferredGenerate (self, msgType, extra)
 
def sendHeartbeatTask (self, task)
 
def setDeferInterval (self, deferInterval)
 
def setServerDelta (self, delta)
 
def specialName (self, label)
 def queryObjectAll(self, doID, context=0): """ Get a one-time snapshot look at the object. More...
 
def startHeartbeat (self)
 
def stopHeartbeat (self)
 
def waitForNextHeartBeat (self)
 
- Public Member Functions inherited from ConnectionRepository
def __init__ (self, connectMethod, config, hasOwnerView=False, threadedNet=None)
 
def checkHttp (self)
 
def connect (self, serverList, successCallback=None, successArgs=[], failureCallback=None, failureArgs=[])
 
def disconnect (self)
 
def generateGlobalObject (self, doId, dcname, values=None)
 
def getServerAddress (self)
 
def handleDatagram (self, di)
 
def handleReaderOverflow (self)
 
def httpConnectCallback (self, ch, serverList, serverIndex, successCallback, successArgs, failureCallback, failureArgs)
 
def importModule (self, dcImports, moduleName, importSymbols)
 
def lostConnection (self)
 
def readDCFile (self, dcFileNames=None)
 
def readerPollOnce (self)
 
def readerPollUntilEmpty (self, task)
 
def send (self, datagram)
 
def shutdown (self)
 
def startReaderPollTask (self)
 
def stopReaderPollTask (self)
 
- Public Member Functions inherited from DoInterestManager
def __init__ (self)
 
def addAutoInterest (self, parentId, zoneIdList, description)
 
def addInterest (self, parentId, zoneIdList, description, event=None)
 
def alterInterest (self, handle, parentId, zoneIdList, description=None, event=None)
 
def cleanupWaitAllInterestsComplete (self)
 
def closeAutoInterests (self, obj)
 
def getAllInterestsCompleteEvent (self)
 
def handleInterestDoneMessage (self, di)
 
def isValidInterestHandle (self, handle)
 
def noNewInterests (self)
 
def openAutoInterests (self, obj)
 
def printInterestHistory (self)
 
def printInterests (self)
 
def printInterestSets (self)
 
def printInterestsIfDebug (self)
 
def queueAllInterestsCompleteEvent (self, frames=5)
 
def removeAIInterest (self, handle)
 
def removeAutoInterest (self, handle)
 
def removeInterest (self, handle, event=None)
 
def resetInterestStateForConnectionLoss (self)
 
def setAllInterestsCompleteCallback (self, callback)
 
def setNoNewInterests (self, flag)
 
def updateInterestDescription (self, handle, desc)
 
- Public Member Functions inherited from DoCollectionManager
def __init__ (self)
 
def addDOToTables (self, do, location=None, ownerView=False)
 
def callbackWithDo (self, doId, callback)
 
def callbackWithOwnerView (self, doId, callback)
 
def countObjects (self, classType)
 
def deleteDistributedObjects (self)
 
def deleteObjectLocation (self, object, parentId, zoneId)
 
def doByDistance (self)
 
def doFind (self, str)
 
def doFindAll (self, str)
 
def doFindAllInstances (self, cls)
 
def doFindAllMatching (self, str)
 
def doFindAllOfType (self, query)
 
def dosByDistance (self)
 
def findAnyOfType (self, type)
 
def getAllOfType (self, type)
 
def getDo (self, doId)
 
def getDoIdList (self, parentId, zoneId=None, classType=None)
 
def getDoList (self, parentId, zoneId=None, classType=None)
 
def getDoTable (self, ownerView)
 
def getGameDoId (self)
 
def 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)

HACK: DistributedGuildMemberUD starts in -1, -1, which isnt ever put in the

zoneId2doIds table

if self.isValidLocationTuple(oldLocation): assert self.notify.debugStateCall(self) assert oldLocation in self.zoneId2doIds assert do.doId in self.zoneId2doIds[oldLocation] assert do.doId not in self.zoneId2doIds.get(newLocation, {})

remove from old zone

del(self.zoneId2doIds[oldLocation][do.doId]) if len(self.zoneId2doIds[oldLocation]) == 0: del self.zoneId2doIds[oldLocation] if self.isValidLocationTuple(newLocation):

add to new zone

self.zoneId2doIds.setdefault(newLocation, {}) self.zoneId2doIds[newLocation][do.doId]=do More...
 
def getObjectsOfClassInZone (self, parentId, zoneId, objClass)
 
def getOwnerView (self, doId)
 
def getOwnerViewDoIdList (self, classType)
 
def getOwnerViewDoList (self, classType)
 
def handleObjectLocation (self, di)
 
def handleSetLocation (self, di)
 
def hasOwnerViewDoId (self, doId)
 
def isInDoTables (self, doId)
 
def isValidLocationTuple (self, location)
 
def printObjectCount (self)
 
def printObjects (self)
 
def removeDOFromTables (self, do)
 
def storeObjectLocation (self, object, parentId, zoneId)
 
def webPrintObjectCount (self)
 

Public Attributes

 bootedIndex
 
 bootedText
 
 cache
 
 cacheOwner
 
 context
 
 dcSuffix
 
 deferInterval
 
 deferredDoIds
 
 deferredGenerates
 
 doDataCache
 
 heartbeatInterval
 
 heartbeatStarted
 
 lastGenerate
 
 lastHeartbeat
 
 noDefer
 
 parentMgr
 
 recorder
 
 relatedObjectMgr
 
 serverDelta
 
 specialNameNumber
 
 timeManager
 
- Public Attributes inherited from ConnectionRepository
 bootedIndex
 if self.recorder and self.recorder.isPlaying(): More...
 
 bootedText
 
 config
 
 connectHttp
 
 connectMethod
 
 dclassesByName
 
 dclassesByNumber
 
 dcSuffix
 
 hashVal
 
 http
 
 private__di
 
 readerPollTaskObj
 
 recorder
 
 uniqueId
 
- Public Attributes inherited from DoCollectionManager
 doId2do
 
 doId2ownerView
 self.zoneId2doIds={} More...
 

Static Public Attributes

 notify = DirectNotifyGlobal.directNotify.newCategory("ClientRepositoryBase")
 
- Static Public Attributes inherited from ConnectionRepository
int CM_HTTP = 0
 
int CM_NATIVE = 2
 
int CM_NET = 1
 
string GarbageCollectTaskName = "allowGarbageCollect"
 
string GarbageThresholdTaskName = "adjustGarbageCollectThreshold"
 
 gcNotify = directNotify.newCategory("GarbageCollect")
 
 notify = DirectNotifyGlobal.directNotify.newCategory("ConnectionRepository")
 
 taskChain = None
 
int taskPriority = -30
 
- Static Public Attributes inherited from DoInterestManager
 dConfigParam
 
 InterestDebug = tempbase.config.GetBool('interest-debug', False)
 
 notify = directNotify.newCategory("DoInterestManager")
 
 tempbase = base
 
 types
 

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__()

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

Member Function Documentation

◆ allocateContext()

def allocateContext (   self)

◆ considerHeartbeat()

def considerHeartbeat (   self)
Send a heartbeat message if we haven't sent one recently.

◆ disableDoId()

def disableDoId (   self,
  doId,
  ownerView = False 
)

◆ doDeferredGenerate()

def doDeferredGenerate (   self,
  task 
)
This is the task that generates an object on the deferred
queue. 

◆ doGenerate()

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

◆ flushGenerates()

def flushGenerates (   self)
Forces all pending generates to be performed immediately. 

◆ generateWithRequiredFields()

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

◆ generateWithRequiredOtherFields()

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

◆ generateWithRequiredOtherFieldsOwner()

def generateWithRequiredOtherFieldsOwner (   self,
  dclass,
  doId,
  di 
)

◆ getObjectsOfClass()

def getObjectsOfClass (   self,
  objClass 
)
returns dict of doId:object, containing all objects
that inherit from 'class'. returned dict is safely mutable. 

◆ getObjectsOfExactClass()

def 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()

def getServerDelta (   self)

◆ getServerTimeOfDay()

def 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()

def getTables (   self,
  ownerView 
)

◆ getWorld()

def getWorld (   self,
  doId 
)

◆ handleDelete()

def handleDelete (   self,
  di 
)

◆ handleGoGetLost()

def handleGoGetLost (   self,
  di 
)

◆ handleServerHeartbeat()

def handleServerHeartbeat (   self,
  di 
)

◆ handleSystemMessage()

def handleSystemMessage (   self,
  di 
)

◆ handleSystemMessageAknowledge()

def handleSystemMessageAknowledge (   self,
  di 
)

◆ handleUpdateField()

def 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.

◆ isLive()

def isLive (   self)

◆ isLocalId()

def isLocalId (   self,
  id 
)

◆ printDelayDeletes()

def printDelayDeletes (   self)

◆ replaceMethod()

def replaceMethod (   self,
  oldMethod,
  newFunction 
)

◆ replayDeferredGenerate()

def replayDeferredGenerate (   self,
  msgType,
  extra 
)
Override this to do something appropriate with deferred
"generate" messages when they are replayed().

◆ sendHeartbeatTask()

def sendHeartbeatTask (   self,
  task 
)

◆ setDeferInterval()

def 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()

def 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()

def 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()

def startHeartbeat (   self)

◆ stopHeartbeat()

def stopHeartbeat (   self)

◆ waitForNextHeartBeat()

def waitForNextHeartBeat (   self)

Member Data Documentation

◆ bootedIndex

bootedIndex

◆ bootedText

bootedText

◆ cache

cache

◆ cacheOwner

cacheOwner

◆ context

context

◆ dcSuffix

dcSuffix

◆ deferInterval

deferInterval

◆ deferredDoIds

deferredDoIds

◆ deferredGenerates

deferredGenerates

◆ doDataCache

doDataCache

◆ heartbeatInterval

heartbeatInterval

◆ heartbeatStarted

heartbeatStarted

◆ lastGenerate

lastGenerate

◆ lastHeartbeat

lastHeartbeat

◆ noDefer

noDefer

◆ notify

notify = DirectNotifyGlobal.directNotify.newCategory("ClientRepositoryBase")
static

◆ parentMgr

parentMgr

◆ recorder

recorder

◆ relatedObjectMgr

relatedObjectMgr

◆ serverDelta

serverDelta

◆ specialNameNumber

specialNameNumber

◆ timeManager

timeManager