# direct.distributed.ClientRepositoryBase¶

from direct.distributed.ClientRepositoryBase import ClientRepositoryBase


Inheritance diagram

class ClientRepositoryBase(dcFileNames=None, dcSuffix='', connectMethod=None, threadedNet=None)[source]

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.

__init__(self, dcFileNames=None, dcSuffix='', connectMethod=None, threadedNet=None)[source]
allocateContext(self)[source]
considerHeartbeat(self)[source]

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

disableDoId(self, doId, ownerView=False)[source]
doDeferredGenerate(self, task)[source]

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

doGenerate(self, parentId, zoneId, classId, doId, di)[source]
flushGenerates(self)[source]

Forces all pending generates to be performed immediately.

generateWithRequiredFields(self, dclass, doId, di, parentId, zoneId)[source]
generateWithRequiredOtherFields(self, dclass, doId, di, parentId=None, zoneId=None)[source]
generateWithRequiredOtherFieldsOwner(self, dclass, doId, di)[source]
getObjectsOfClass(self, objClass)[source]

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

getObjectsOfExactClass(self, objClass)[source]

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

getServerDelta(self)[source]
getServerTimeOfDay(self)[source]

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(self, ownerView)[source]
getWorld(self, doId)[source]
handleDelete(self, di)[source]
handleGoGetLost(self, di)[source]
handleServerHeartbeat(self, di)[source]
handleSystemMessage(self, di)[source]
handleSystemMessageAknowledge(self, di)[source]
handleUpdateField(self, di)[source]

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(self)[source]
isLocalId(self, id)[source]
notify = <direct.directnotify.Notifier.Notifier object>
printDelayDeletes(self)[source]
replaceMethod(self, oldMethod, newFunction)[source]
replayDeferredGenerate(self, msgType, extra)[source]

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

sendHeartbeatTask(self, task)[source]
setDeferInterval(self, deferInterval)[source]

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(self, delta)[source]

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(self, label)[source]
startHeartbeat(self)[source]
stopHeartbeat(self)[source]
waitForNextHeartBeat(self)[source]