deephaven.plugin.object_type

class BidirectionalObjectType[source]

Bases: ObjectType

Base class for an object type that can continue to send responses to the client, or receive requests from the server even after it is fetched.

abstract create_client_connection(obj, connection)[source]

Signals creation of a client stream to the specified object. The returned MessageStream implementation will be called with each received message from the client, and can call the provided connection parameter to send messages as needed to the client.

Before returning, this method must call connection.on_message with some initial payload, so that the client has an initial view of the object.

Return type:

MessageStream

abstract is_type(obj)

Returns True if, and only if, the object is compatible with this object type.

Return type:

bool

abstract property name

The name of the object type.

class Exporter[source]

Bases: ABC

The interface for creating new references during FetchOnlyObjectBase.to_bytes.

abstract reference(obj)[source]

Creates a reference for an object, ensuring that it is exported for use on the client. Each time this is called, a new reference will be returned, with the index of the export in the data to be sent to the client.

Return type:

Reference

class FetchOnlyObjectType[source]

Bases: ObjectType

Base class for an object type which will only be fetched once, rather than support streaming requests or responses.

abstract is_type(obj)

Returns True if, and only if, the object is compatible with this object type.

Return type:

bool

abstract property name

The name of the object type.

abstract to_bytes(exporter, obj)[source]

Serializes obj into bytes. Must only be called with a compatible object.

Return type:

bytes

class MessageStream[source]

Bases: ABC

A stream of messages, either sent from server to client or client to server. ObjectType implementations provide an instance of this interface for each incoming stream to invoke as messages arrive, and will likewise be given an instance of this interface to be able to send messages to the client.

abstract on_close()[source]

Closes the stream on both ends. No further messages can be sent or received.

Return type:

None

abstract on_data(payload, references)[source]

Transmits data to the remote end of the stream. This can consist of a binary payload and references to objects on the server.

Return type:

None

class ObjectType[source]

Bases: Plugin

An object type plugin. Useful for serializing custom objects between the server / client.

abstract is_type(obj)[source]

Returns True if, and only if, the object is compatible with this object type.

Return type:

bool

abstract property name

The name of the object type.

class Reference(index, type)[source]

Bases: object

A reference.

property index

The index, which is defined by the order in which references are created. May be used in the output stream to refer to the reference from the client.