Models
Models for the dasf-broker-django app.
Models:
|
A message sent to the broker. |
|
A topic for producing and consuming requests via websocket |
|
A topic that accepts responses for messages. |
Classes:
|
A manager for broker topics. |
|
A queryset for broker topics. |
- class dasf_broker.models.BrokerMessage(*args, **kwargs)
Bases:
Model
A message sent to the broker.
Miscellaneous:
Model Fields:
A wrapper for a deferred-loading field.
A wrapper for a deferred-loading field.
A wrapper for a deferred-loading field.
A wrapper for a deferred-loading field.
A wrapper for a deferred-loading field.
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
Attributes:
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
Test if the message has been delivered to all consumers.
Is this message a response to a DASF request?
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
Methods:
get_next_by_date_created
(*[, field, is_next])get_previous_by_date_created
(*[, field, is_next])send
()Send the message via the websocket.
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- content
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- context
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_created
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- delivered_to
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- get_next_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=True, **kwargs)
- get_previous_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=False, **kwargs)
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- message_id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>
- responsetopic_set
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- send()
Send the message via the websocket.
- topic
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- topic_id
- user
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- user_id
- class dasf_broker.models.BrokerTopic(*args, **kwargs)
Bases:
Model
A topic for producing and consuming requests via websocket
Miscellaneous:
Classes:
StoreMessageChoices
(value)Choices for storing messages.
Attributes:
Get the online/offline status for the topic.
Accessor to the related objects manager on the reverse side of a many-to-one relation.
Get the store message rule for this topic.
Is this topic a responsetopic?
Accessor to the related object on the reverse side of a one-to-one relation.
Accessor to the related objects manager on the reverse side of a many-to-one relation.
Methods:
build_websocket_url
(request[, route])create_and_send_message
(user, content)Create and send a message for the user
get_next_by_date_created
(*[, field, is_next])get_outstanding_messages
([user])Get the messages that still need to be send.
get_previous_by_date_created
(*[, field, is_next])get_store_messages_display
(*[, field])get_websocket_url
(request)Get the websocket url for this topic.
ping
()Create a ping message and send it to the consumer.
Model Fields:
A wrapper for a deferred-loading field.
A wrapper for a deferred-loading field.
A wrapper for a deferred-loading field.
A wrapper for a deferred-loading field.
A wrapper for a deferred-loading field.
A wrapper for a deferred-loading field.
A wrapper for a deferred-loading field.
A wrapper for a deferred-loading field.
A wrapper for a deferred-loading field.
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- class StoreMessageChoices(value)
Bases:
TextChoices
Choices for storing messages.
Attributes:
- CACHE = 'cache'
- CACHEALL = 'cacheall'
- DISABLED = 'disabled'
- STORE = 'store'
- availability
Get the online/offline status for the topic.
This value can be
True
,False
orNone
:- None
The status is unknown. This occurs when the last ping was more than two minutes ago or the topic has never, been pinged.
- False
The was no pong yet or the last pong was before the last ping and the last ping was less than two minutes ago.
- True
The topic is online, i.e. we received a pong after the last ping and the last ping was less then two minutes ago.
- brokermessage_set
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- property consumers: models.QuerySet[User]
- create_and_send_message(user: User, content: Dict)
Create and send a message for the user
- date_created
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property effective_store_messages: StoreMessageChoices
Get the store message rule for this topic.
- garbage_collect_on
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_next_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=True, **kwargs)
- get_outstanding_messages(user: User | None = None) models.QuerySet[BrokerMessage]
Get the messages that still need to be send.
- Parameters:
user (Optional[User]) – The user for whom to send the messages. If None, the messages will be returned that have not yet been acknowledged at all.
- Returns:
A QuerySet of messages
- Return type:
models.QuerySet[BrokerMessage]
- get_previous_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=False, **kwargs)
- get_store_messages_display(*, field=<django.db.models.fields.CharField: store_messages>)
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_public
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- last_ping
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- last_pong
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <dasf_broker.models.BrokerTopicManager object>
- ping()
Create a ping message and send it to the consumer.
- property producers: models.QuerySet[User]
- responsetopic
Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
- responsetopics
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- slug
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property status_viewers: models.QuerySet[User]
- store_messages
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- supports_dasf
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class dasf_broker.models.BrokerTopicManager(*args, **kwargs)
Bases:
ManagerFromBrokerTopicQuerySet
A manager for broker topics.
- class dasf_broker.models.BrokerTopicQuerySet(model=None, query=None, using=None, hints=None)
Bases:
QuerySet
A queryset for broker topics.
Methods:
filter_offline
(*args)Query all online broker topics.
filter_online
(*args, **kwargs)Query all online broker topics.
filter_unknown_availability
(*args)Query all topics where the availability is unknown.
- filter_offline(*args)
Query all online broker topics.
- filter_online(*args, **kwargs)
Query all online broker topics.
- filter_unknown_availability(*args)
Query all topics where the availability is unknown.
- class dasf_broker.models.ResponseTopic(*args, **kwargs)
Bases:
BrokerTopic
A topic that accepts responses for messages.
Miscellaneous:
Model Fields:
Accessor to the related object on the forward side of a one-to-one relation.
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
Attributes:
Is this topic a responsetopic?
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
- exception DoesNotExist
Bases:
DoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- brokertopic_ptr: BrokerTopic
Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
- brokertopic_ptr_id
- is_response_for
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- is_response_for_id
- source_messages
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.