class RequestManager:
RequestManager class.
| Method | add |
Add a response and topic to the response dictionary. The key is the rqi (requestIdentifier) of the response. |
| Method | config |
Callback for the configUpdate event. |
| Method | determine |
Resolve the real URL and more message parameters for a request and a target, |
| Method | dissect |
Dissect a request in a byte string and build up a CSERequest instance. |
| Method | fill |
Fill a cseRequest object according to its request structure in the Result.request attribute. |
| Method | get |
Get for the content serializations of a registered originator. |
| Method | handle |
Handle an incoming CREATE request. |
| Method | handle |
Handle an incoming DELETE request. |
| Method | handle |
Handle an incoming NOTIFY request. |
| Method | handle |
Handle a NOTIFY request to resource. |
| Method | handle |
Calls the fitting request handler for an operation and let that handle the request. |
| Method | handle |
Handle an incoming RETRIEVE request. |
| Method | handle |
Handle a send request. This method is used to send a request to a remote CSE or to a local resource. |
| Method | handle |
Forward a CREATE request to a remote CSE. |
| Method | handle |
Forward a DELETE request to a remote CSE. |
| Method | handle |
Forward a NOTIFY request to a remote CSE. |
| Method | handle |
Forward a RETRIEVE request to a remote CSE |
| Method | handle |
Forward an UPDATE request to a remote CSE. |
| Method | handle |
Handle an incoming UPDATE request. |
| Method | has |
Check whether there is a pending request or response pending for the tuple (originator, requestID). This method is also used as a callback for periodic check whether a request or response is queued. If ... |
| Method | initialize |
Initialize the RequestManager. |
| Method | prepare |
Prepare a new request for MQTT or WebSocket sending. |
| Method | process |
Calls the fitting request process handler for an operation and call it. |
| Method | queue |
Add a new request to the polling request queue. |
| Method | queue |
Queue a (incoming) request or content for a <PCH>. It can be retrieved via the target's <PCU> child resource. |
| Method | record |
Record a request and its response in the database. |
| Method | request |
Convert a response request to a new Result object and create a new dictionary in Result.data with the full Response structure. Recursively do this if the embeddedRequest is also a full Request or Response. |
| Method | response |
Shortcut for requestFromResult to create a response object. |
| Method | restart |
Restart the registrationManager service. |
| Method | shutdown |
Shutdown the RequestManager. |
| Method | unqueue |
Remove a request for the originator and with the requestID from the polling request queue. |
| Method | wait |
Busy waiting for a polling request. The function returns when there is a new or pending matching request in the queue, or when the timeout (in seconds) is met. |
| Method | wait |
Wait for a response with a specific requestIdentifier rqi. |
| Method | wait |
Wait for a RESPONSE to a request. |
| Class Variable | __slots__ |
Slots for RequestManager class. |
| Class Variable | coap |
The injected CoAPServer plugin instance is injected by the PluginManager based on the declared dependency. |
| Class Variable | dispatcher |
Injected Dispatcher instance. |
| Class Variable | http |
The injected HttpServer plugin instance is injected by the PluginManager based on the declared dependency. |
| Class Variable | mqtt |
The injected MQTTClient plugin instance is injected by the PluginManager based on the declared dependency. |
| Class Variable | notification |
Injected NotificationManager instance. |
| Class Variable | registration |
Injected RegistrationManager instance. |
| Class Variable | remote |
The injected RemoteCSEManager plugin instance is injected by the PluginManager based on the declared dependency. |
| Class Variable | security |
Injected SecurityManager instance. |
| Class Variable | storage |
Injected Storage instance. |
| Class Variable | validator |
Injected Validator instance. |
| Class Variable | websocket |
The injected WebSocketServer plugin instance is injected by the PluginManager based on the declared dependency. |
| Instance Variable | enable |
Whether request recording is enabled. |
| Instance Variable | flex |
Whether flexBlocking requests are handled as blocking or non-blocking. |
| Instance Variable | max |
The maximum request expiration delta value. |
| Instance Variable | request |
The request expiration delta value. |
| Instance Variable | request |
Dictionary to map operations to their corresponding request handling functions, dispatcher processing functions, send functions, and events for different protocols. |
| Instance Variable | request |
RingBuffer to store requests for later retrieval. |
| Instance Variable | send |
Whether to include the 'to' and 'from' fields in responses. |
| Method | _assign |
Store relevant configuration values in the manager. |
| Method | _cleanup |
Remove expired requests from the polling request queue. This method is called periodically by an actor. |
| Method | _create |
Create a <request> resource for the given request. |
| Method | _execute |
Execute a request operation and fill the respective request resource accordingly. |
| Method | _handle |
This method creates a <request> resource, initiates the execution of the desired operation in the background, but immediately returns with the reference of the <request> resource that will contain the result of the operation. |
| Method | _originator |
Convert from to CSE-relative, SP-relative or Absolute format in the request. The from is converted in request.originator and request.originalRequest, but NOT in request.originalData. |
| Method | _run |
Execute the actual request and store the result in the respective <request> resource. In addition notify the notification targets. |
| Method | _run |
Execute the actual request and store the result in the respective <request> resource. |
| Method | _send |
Send a request via the appropriate channel or transport protocol. |
| Instance Variable | _pc |
Worker to clean up expired polling requests. |
| Instance Variable | _received |
Dictionary to store received responses for non-blocking requests. |
| Instance Variable | _received |
Lock to access the received responses dictionary. |
| Instance Variable | _request |
Lock to access the following two dictionaries. |
| Instance Variable | _requests |
Dictionary to map request originators to a list of requests. Used for handling polling requests. |
| Instance Variable | _rqi |
Dictionary to map requestIdentifiers to an originator of a request. Used for handling of polling requests. |
Add a response and topic to the response dictionary. The key is the rqi (requestIdentifier) of the response.
Callback for the configUpdate event.
| Parameters | |
eventEventData | The event data, containing the name of the updated configuration setting and its new value. |
Resolve the real URL and more message parameters for a request and a target,
Notes
A successful determination may include the type of the target resource. This is different from the request content's resource type.
| Parameters | |
request:CSERequest | The request from which the target details are taken from. |
| Returns | |
The results could differ | The result is a list of tuples of (real url including the protocol, list of allowed contentSerializations, target supported release version, PollingChannel resource, originator with adapted scope, target uri, determined target resource type). Or, return a list of (url, None, None, None, originator, None, UNKNOWN), containing only one element, if the URI is already a URL. We cannot determine the preferred serializations in this case. and we don't know the target entity. Return a list of (None, list of allowed contentSerializations, srv, PollingChannel resource, originator with adapted scope, target, uri, determined target resource type), containing only one element, if the target resourec is not request reachable and has a PollingChannel as a child resource. Otherwise, return a list of the mentioned tuples. In case of an error, an empty list is returned. |
bytes, contenType: ContentSerializationType, isResponse: bool | None = False) -> Result:
¶
Dissect a request in a byte string and build up a CSERequest instance.
| Parameters | |
data:bytes | The data to dissect. |
contenContentSerializationType | The content type of the data. |
isbool | None | If True then the data is a response, otherwise it is a request. |
| Returns | |
Result | A Result instance with the dissected request in Result.request. The Result.data contains the pc of the request. |
CSERequest | JSON, isResponse: bool | None = False) -> CSERequest:
¶
Fill a cseRequest object according to its request structure in the Result.request attribute.
Get for the content serializations of a registered originator.
It is either an AE, a CSE or a CSR.
| Parameters | |
originator:str | The originator to check. |
| Returns | |
list[ | List of ContentSerializationTypes. |
Handle an incoming CREATE request.
| Parameters | |
request:CSERequest | The incoming request. |
| Returns | |
Result | Result of the request handling. |
| Raises | |
BAD_REQUEST | If the request is invalid. |
Handle an incoming DELETE request.
| Parameters | |
request:CSERequest | The incoming request. |
| Returns | |
Result | Result of the request handling. |
| Raises | |
OPERATION_NOT_ALLOWED | If the operation is not allowed. |
BAD_REQUEST | If the request is invalid. |
Handle an incoming NOTIFY request.
| Parameters | |
request:CSERequest | The incoming request. |
| Returns | |
Result | Result of the request handling. |
| Raises | |
BAD_REQUEST | If the request is invalid. |
Calls the fitting request handler for an operation and let that handle the request.
Before the request is processed it will be determined whether it is blocking or non-blocking etc.
| Parameters | |
request:CSERequest | JSON | The incoming request. |
| Returns | |
Result | Request result. |
Handle an incoming RETRIEVE request.
| Parameters | |
request:CSERequest | The incoming request. |
| Returns | |
Result | Result of the request handling. |
| Raises | |
BAD_REQUEST | If the request is invalid. |
Handle a send request. This method is used to send a request to a remote CSE or to a local resource.
| Parameters | |
request:CSERequest | The request to send. |
| Returns | |
RequestResponseList | A list of RequestResponse objects containing the request and the result of the send operation. |
Handle an incoming UPDATE request.
Raises:
| Parameters | |
request:CSERequest | The incoming request. |
| Returns | |
Result | Result of the request handling. |
str, requestID: str = None, reqType: RequestType = RequestType.REQUEST) -> bool:
¶
Check whether there is a pending request or response pending for the tuple (originator, requestID). This method is also used as a callback for periodic check whether a request or response is queued. If requestID is not None then the check is for a request with that ID. Otherwise, True will be returned if there is any request for the originator.
Result, isResponse: bool | None = False, originalRequest: CSERequest | None = None) -> tuple[ Result, bytes]:
¶
Prepare a new request for MQTT or WebSocket sending.
Attention
Remember, a response is actually just a new request. This takes care of the fact that in MQTT or WebSockets a response is very similar to a response.
| Parameters | |
inResult | A Result object, that contains a request in its request attribute. |
isbool | None | Indicator whether the Result object is actually a response or a request. |
originalCSERequest | None | The original request that was received. |
| Returns | |
tuple[ | A tuple with an updated Result object and the serialized content. |
Calls the fitting request process handler for an operation and call it.
This will directly handle the request.
- Result:
- Request result
| Parameters | |
request:CSERequest | Undocumented |
originator:str | The request originator. |
id:str | The structured or unstructured resource id. |
| Returns | |
Result | Undocumented |
Add a new request to the polling request queue.
The reqType specifies whether this request is a oneM2M Request or Response.
Operation, pchOriginator: str, content: JSON = None, ty: ResourceTypes = None, rvi: str = None, request: CSERequest = None, reqType: RequestType = RequestType.REQUEST, ec: EventCategory = None, originator: str = None) -> CSERequest | None:
¶
Queue a (incoming) request or content for a <PCH>. It can be retrieved via the target's <PCU> child resource.
If a request is passed then this object is queued. If no request but data is given then a new request object is created for content.
Record a request and its response in the database.
| Parameters | |
request:CSERequest | None | The request to record. If None, then no recording is done. |
result:Result | The result of the request, containing the response to record. |
Result, originator: str | None = None, ty: ResourceTypes | None = None, op: Operation | None = None, isResponse: bool | None = False, originalRequest: CSERequest | None = None) -> Result:
¶
Convert a response request to a new Result object and create a new dictionary in Result.data with the full Response structure. Recursively do this if the embeddedRequest is also a full Request or Response.
See Also
| Parameters | |
inResult | The input Result object. |
originator:str | None | The request originator. |
ty:ResourceTypes | None | Optional resource type. |
op:Operation | None | Optional request operation type |
isbool | None | Whether the result is actually a response, and not a request. |
originalCSERequest | None | Undocumented |
| Returns | |
Result | Result object with the response. The request or response is in data. |
Shortcut for requestFromResult to create a response object.
| Parameters | |
inResult | Result that contains the response. |
originator:str | None | Originator for the response. |
| Returns | |
Result | Result object with the response. |
str, requestID: str, reqType: RequestType) -> CSERequest:
¶
Remove a request for the originator and with the requestID from the polling request queue.
str, requestID: str, timeout: float, reqType: RequestType | None = RequestType.REQUEST, aggregate: bool | None = False) -> Result:
¶
Busy waiting for a polling request. The function returns when there is a new or pending matching request in the queue, or when the timeout (in seconds) is met.
| Parameters | |
originator:str | Request originator to match. |
requeststr | Request Identifier to match. Might be None to match all request IDs. |
timeout:float | Timeout in seconds for the polling request to wait. |
reqRequestType | None | Match request or response. |
aggregate:bool | None | Boolean indicating whether all the available requests shall be returned in one aggregation, or separately. |
| Returns | |
Result | The function returns a Result object with the request or aggregated requests in the request attribute. |
The injected CoAPServer plugin instance is injected by the PluginManager based on the declared dependency.
The injected HttpServer plugin instance is injected by the PluginManager based on the declared dependency.
The injected MQTTClient plugin instance is injected by the PluginManager based on the declared dependency.
The injected RemoteCSEManager plugin instance is injected by the PluginManager based on the declared dependency.
The injected WebSocketServer plugin instance is injected by the PluginManager based on the declared dependency.
Dictionary to map operations to their corresponding request handling functions, dispatcher processing functions, send functions, and events for different protocols.
Remove expired requests from the polling request queue. This method is called periodically by an actor.
Returns:
Create a <request> resource for the given request.
| Parameters | |
request:CSERequest | The request for which to create the <request> resource. |
| Returns | |
Resource | The created <request> resource. |
Execute a request operation and fill the respective request resource accordingly.
| Parameters | |
request:CSERequest | The request to execute. |
reqstr | The <request> resource id. |
| Returns | |
REQ | The <request> resource. |
This method creates a <request> resource, initiates the execution of the desired operation in the background, but immediately returns with the reference of the <request> resource that will contain the result of the operation.
Convert from to CSE-relative, SP-relative or Absolute format in the request. The from is converted in request.originator and request.originalRequest, but NOT in request.originalData.
See TS-0004, 7.3.2.6, Forwarding
Execute the actual request and store the result in the respective <request> resource. In addition notify the notification targets.