retrieval of data after publishing a message made optional #23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request refactors several modules to improve consistency in dataclass usage and updates the object queue publishing logic to better handle data retrieval and memory management. The most important changes include replacing
pydantic.dataclasses.dataclass
with the standard library'sdataclasses.dataclass
, modifying theObjectQueue
'spublish
method to support optional data retrieval, and optimizing how published data is stored and evicted. Additionally, related methods and usages throughout the codebase have been updated to reflect these changes.Refactoring and Standardization
pydantic.dataclasses.dataclass
with the standard library'sdataclasses.dataclass
across multiple files (src/dtps_http/link_headers.py
,src/dtps_http/object_queue.py
,src/dtps_http/server.py
,src/dtps_http/structures.py
). [1] [2] [3] [4]Object Queue Publishing Logic
ObjectQueue.publish
method to accept a newget_data
parameter, which determines whether to return the published data or just acknowledge the publish action. The default behavior now returnsNone
unlessget_data=True
is specified. [1] [2]publish_text
,publish_cbor
,publish_json
,publish_yaml
) to passget_data=True
to ensure they return the published data as expected.Data Storage and Eviction
stored
deque inObjectQueue
to use a bounded length (maxlen=bounds.max_size
) and updated the eviction logic to only remove the oldest item when the maximum size is reached, improving memory management and consistency. [1] [2]Type and Structure Adjustments
PostResult
type to allowNone
, reflecting the new optional return value from thepublish
method.ObjectQueue
to rename and clarify member variables, such as using_transform
instead oftransform
.API Usage Updates
ObjectQueue.publish
insrc/dtps_http/types_of_source.py
andsrc/dtps/ergo_create.py
to passget_data=True
, ensuring correct data retrieval after publishing. [1] [2] [3]