Agora-wireless / Agora

Other
53 stars 34 forks source link

[Refactoring] Separate worker and manager class #366

Closed chaeyoung-lee closed 2 years ago

chaeyoung-lee commented 2 years ago

This PR is mainly about separating the worker module from the monolithic Agora class.

Summary

Moving Forward

Sprint Description Dates Components
1 Separation of worker and manager class 7/21-8/10 manager, worker
2 Separation of knowledge from logic in scheduling 9/1-9/16 manager
3 Task abstraction 9/19-10/3 doer, network threads
chaeyoung-lee commented 2 years ago

Major changes after @733c2b9 (Andrew's review)

// agora.h
std::unique_ptr<AgoraBuffer> buffer_;

// agora.cc: construction of Agora manager class
Agora::Agora(Config* const cfg)
    : buffer_(std::make_unique<AgoraBuffer>(cfg)), ... { ... }

// agora.cc: example of accessing buffer class members
const auto* pkt = reinterpret_cast<const MacPacketPacked*>(
              &buffer_->GetDlBitsBuffer(ue_id)[radio_buf_id *
                         config_->MacBytesNumPerframe(Direction::kDownlink)]);

An exception is network buffers. Changing how PacketTxRx class stores and loads data from the network buffers result in conflicts with the PhyUe class in the client side. Therefore, as of now, we leave such network buffers as public members of the AgoraBuffer class.

class AgoraBuffer {
 public:
  // TX RX Buffers
  // Direct access is allowed for packetTXRX classes
  Table<char> socket_buffer_;
  char* dl_socket_buffer_;
  Table<complex_float> calib_ul_buffer_;
  Table<complex_float> calib_dl_buffer_;