From f98561fd5fda3c0a886183172e83d675c0f95721 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Fri, 12 Dec 2025 09:25:34 +0100 Subject: [PATCH 01/18] ImageBuffer: Add counter for changes in the image buffer --- broker/OpenAPIConvert.cpp | 1 + broker/gen/model/Image_buffer_status.cpp | 16 ++++++- broker/gen/model/Image_buffer_status.h | 7 ++++ broker/jfjoch_api.yaml | 7 ++++ broker/redoc-static.html | 6 +-- common/ImageBuffer.cpp | 7 +++- common/ImageBuffer.h | 3 ++ docs/python_client/docs/ImageBufferStatus.md | 1 + frontend/package-lock.json | 4 +- .../src/openapi/models/image_buffer_status.ts | 6 +++ tests/ImageBufferTest.cpp | 42 +++++++++++++++++++ 11 files changed, 93 insertions(+), 7 deletions(-) diff --git a/broker/OpenAPIConvert.cpp b/broker/OpenAPIConvert.cpp index 09261457..cc426d8c 100644 --- a/broker/OpenAPIConvert.cpp +++ b/broker/OpenAPIConvert.cpp @@ -753,6 +753,7 @@ org::openapitools::server::model::Image_buffer_status Convert(const ImageBufferS ret.setImageNumbers(input.images_in_the_buffer); ret.setMaxImageNumber(input.max_image_number); ret.setMinImageNumber(input.min_image_number); + ret.setCurrentCounter(input.current_counter); return ret; } diff --git a/broker/gen/model/Image_buffer_status.cpp b/broker/gen/model/Image_buffer_status.cpp index ca7fbce8..12dd4b94 100644 --- a/broker/gen/model/Image_buffer_status.cpp +++ b/broker/gen/model/Image_buffer_status.cpp @@ -25,6 +25,7 @@ Image_buffer_status::Image_buffer_status() m_Max_image_number = 0L; m_Total_slots = 0L; m_Available_slots = 0L; + m_Current_counter = 0L; } @@ -96,7 +97,7 @@ bool Image_buffer_status::validate(std::stringstream& msg, const std::string& pa } } - + return success; } @@ -118,6 +119,9 @@ bool Image_buffer_status::operator==(const Image_buffer_status& rhs) const && (getAvailableSlots() == rhs.getAvailableSlots()) + && + + (getCurrentCounter() == rhs.getCurrentCounter()) ; @@ -136,6 +140,7 @@ void to_json(nlohmann::json& j, const Image_buffer_status& o) j["image_numbers"] = o.m_Image_numbers; j["total_slots"] = o.m_Total_slots; j["available_slots"] = o.m_Available_slots; + j["current_counter"] = o.m_Current_counter; } @@ -146,6 +151,7 @@ void from_json(const nlohmann::json& j, Image_buffer_status& o) j.at("image_numbers").get_to(o.m_Image_numbers); j.at("total_slots").get_to(o.m_Total_slots); j.at("available_slots").get_to(o.m_Available_slots); + j.at("current_counter").get_to(o.m_Current_counter); } @@ -189,6 +195,14 @@ void Image_buffer_status::setAvailableSlots(int64_t const value) { m_Available_slots = value; } +int64_t Image_buffer_status::getCurrentCounter() const +{ + return m_Current_counter; +} +void Image_buffer_status::setCurrentCounter(int64_t const value) +{ + m_Current_counter = value; +} } // namespace org::openapitools::server::model diff --git a/broker/gen/model/Image_buffer_status.h b/broker/gen/model/Image_buffer_status.h index 36118ca6..46b55f0c 100644 --- a/broker/gen/model/Image_buffer_status.h +++ b/broker/gen/model/Image_buffer_status.h @@ -83,6 +83,11 @@ public: /// int64_t getAvailableSlots() const; void setAvailableSlots(int64_t const value); + /// + /// Counter of changes in the image buffer - either new start message or new image added. For optimization one can only load new images/datasets from the HTTP if this value changes. + /// + int64_t getCurrentCounter() const; + void setCurrentCounter(int64_t const value); friend void to_json(nlohmann::json& j, const Image_buffer_status& o); friend void from_json(const nlohmann::json& j, Image_buffer_status& o); @@ -97,6 +102,8 @@ protected: int64_t m_Available_slots; + int64_t m_Current_counter; + }; diff --git a/broker/jfjoch_api.yaml b/broker/jfjoch_api.yaml index 86e02bb7..79bf01b3 100644 --- a/broker/jfjoch_api.yaml +++ b/broker/jfjoch_api.yaml @@ -693,6 +693,7 @@ components: - available_slots - max_image_number - min_image_number + - current_counter properties: min_image_number: type: integer @@ -720,6 +721,12 @@ components: type: integer format: int64 description: Slots available for the data collection + current_counter: + type: integer + format: int64 + description: | + Counter of changes in the image buffer - either new start message or new image added. + For optimization one can only load new images/datasets from the HTTP if this value changes. image_format_settings: type: object required: diff --git a/broker/redoc-static.html b/broker/redoc-static.html index f786d5da..bc34a41a 100644 --- a/broker/redoc-static.html +++ b/broker/redoc-static.html @@ -1193,7 +1193,7 @@ This can only be done when detector is Idle, Error or " class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

Everything OK

Response samples

Content type
application/json
{
  • "detector": {
    },
  • "detector_list": {
    },
  • "detector_settings": {
    },
  • "image_format_settings": {
    },
  • "instrument_metadata": {
    },
  • "file_writer_settings": {
    },
  • "data_processing_settings": {
    },
  • "measurement": {
    },
  • "broker": {
    },
  • "fpga": [
    ],
  • "calibration": [
    ],
  • "zeromq_preview": {
    },
  • "zeromq_metadata": {
    },
  • "dark_mask": {
    },
  • "pixel_mask": {
    },
  • "roi": {
    },
  • "az_int": {
    },
  • "buffer": {
    },
  • "indexing": {
    }
}

Get data collection statistics

http://localhost:5232/statistics

Response samples

Content type
application/json
{
  • "detector": {
    },
  • "detector_list": {
    },
  • "detector_settings": {
    },
  • "image_format_settings": {
    },
  • "instrument_metadata": {
    },
  • "file_writer_settings": {
    },
  • "data_processing_settings": {
    },
  • "measurement": {
    },
  • "broker": {
    },
  • "fpga": [
    ],
  • "calibration": [
    ],
  • "zeromq_preview": {
    },
  • "zeromq_metadata": {
    },
  • "dark_mask": {
    },
  • "pixel_mask": {
    },
  • "roi": {
    },
  • "az_int": {
    },
  • "buffer": {
    },
  • "indexing": {
    }
}

Get data collection statistics

Results of the last data collection

Responses

Response samples

Content type
application/json
{
  • "min_image_number": 0,
  • "max_image_number": 0,
  • "image_numbers": [
    ],
  • "total_slots": 0,
  • "available_slots": 0
}

Get Jungfraujoch version of jfjoch_broker

Responses

Response samples

Content type
application/json
{
  • "min_image_number": 0,
  • "max_image_number": 0,
  • "image_numbers": [
    ],
  • "total_slots": 0,
  • "available_slots": 0,
  • "current_counter": 0
}

Get Jungfraujoch version of jfjoch_broker

Responses