From Violet Baboon, 5 Years ago, written in Plain Text.
- view diff
  1. - blade_session_t
  2.  - blade_session_send(blade_session_t *bs, cJSON *json)
  3.   - Application layer produces the json and calls this
  4.   - Break down the json, determine if it is a request or a response/error
  5.   - If request, produce a blade_request_t and cache it in the main handle with a TTL, lookup upon receiving a response or error
  6.    - Blade main handle requires it's own maintenance thread running to deal with expiring objects like sessions and requests
  7.  - blade_session_process(blade_session_t *bs, cJSON *json)
  8.   - Session state machine pops received json from it's queue and calls this
  9.   - Break down the json, determine if it is a request or response/error
  10.   - If request, lookup the callbacks within the local RPC method registry (research Colm's RPC code to figure out where this is at)
  11.   - If response or error, lookup the original outgoing request by the message id from the main handle to obtain the method or callbacks
  12.  - Per Jerris' suggestion, segregate state machine states into their own functions (for both session and connection)
  14. - blade_request_t
  15.  - blade_handle_requests_add(blade_request_t *br)
  16.   - Add a request to the cache
  17.  - blade_handle_requests_remove(blade_request_t *br)
  18.   - Remove a request from the cache
  19.  - blade_handle_requests_get(blade_handle_t *bh, const char *id)
  20.   - Lookup a cached request by the message id
  21.  - When receiving or sending a request this is produced to unify the request passed around
  22.  - When sending an outbound request this is cached with a TTL for linking to an inbound response
  23.  - This is what is passed into the request callback for a method
  25. - blade_response_t
  26.  - This is only produced when receiving a response to collect required information for the callback
  27.  - When receiving a response, the original blade_request_t is obtained and associated to the response
  28.  - This is what is passed into the response callback for a method
  30. - blade_method_t (or whatever...)
  31.  - Plumbing for construction/destruction which retains internal blade_handle_t reference
  32.  - blade_handle_methods_add(blade_method_t *bm)
  33.   - Add a method to the main registry
  34.  - blade_handle_methods_remove(blade_method_t *bm)
  35.   - Remove a method from the main registry
  36.  - blade_handle_methods_get(blade_handle_t *bh, const char *method)
  37.   - Lookup an rpc method by the fully qualified method name
  38.  - More about method "spaces" later, they are collectives of methods added and removed together and possibly other factors shared among some methods
  40. - DSO
  41.  - Macros to define and export symbol for pointer to blade_module_callbacks_t structure allowing onload to be called
  42.  - onload(blade_module_t **bmP, blade_handle_t *bh) - module initialization, upon return the blade_module_t can be registered by the core
  43.  - onunload(blade_module_t **bmP) - module can be deregistered by core before calling this for cleanup
  44.  - onstartup(blade_module_t *bm, config_setting_t *config) - transport and method initialization and registration
  45.  - onshutdown(blade_module_t *bm) - transport and method deregistration and cleanup