Skip to content

Replace internal-only DataStructures containers with the standard library (std migration, stage 1) #59

Open

Description

@Segfaultd

Follow-up to #50 / #58. First of three stages replacing RakNet's homegrown DataStructures::* containers (Source/include/mafianet/ds_*.h) with the C++ standard library. This stage touches only containers that never appear in a public signature, so it is API-neutral and can land on its own.

Scope

Containers whose only consumers are inside the library:

Container Consumers Likely replacement
DataStructures::RangeList reliability_layer.{h,cpp} (ack ranges) std::vector of ranges, or keep a small purpose-built type
DataStructures::BPlusTree reliability_layer.h (split-packet channel lookup) std::map / std::unordered_map
DataStructures::Heap reliability_layer.h (resend ordering) std::priority_queue
DataStructures::LinkedList reliability_layer.{h,cpp} std::list or std::deque
DataStructures::Multilist udp_proxy_coordinator.{h,cpp}, udp_proxy_client.h std::vector + std::unordered_map
DataStructures::WeightedGraph, Tree, HuffmanEncodingTree* no DataStructures:: use left outside their own headers (connection_graph2.h includes but does not use WeightedGraph) delete after confirming

Out of scope here and in every stage: MemoryPool, ThreadsafeAllocatingQueue and Page are allocators wired to rakMalloc/file-and-line tracking, not containers; Table is the in-memory database behind the SQL plugins. They stay.

Approach

  • One container per commit, each landing green on the full suite (ctest -L unit and -L integration, Linux Debug and Release in Docker since the reliability layer is involved).
  • Before replacing, check for semantics the standard type lacks: RemoveAtIndexFast swap-removal, explicit capacity on the ring-buffer Queue, comparator function pointers on OrderedList, RangeList merge behaviour.
  • The reliability layer is performance-sensitive: record before/after numbers from the loopback throughput integration tests and the hermetic ReliabilityLayer harness in the PR.
  • Delete each ds_*.h once its last consumer is gone; ds_weighted_graph.h, ds_tree.h and the Huffman factory look deletable immediately.

Acceptance

  • No DataStructures:: use of the listed containers remains under Source/.
  • Public headers are byte-for-byte unchanged in their declarations (verified by diffing include/mafianet/*.h signatures).
  • Full suite green on Linux (Debug, Release), macOS, Windows.
  • Throughput numbers recorded in the PR, no regression beyond noise.

Tracking: this is stage 1 of three. Stage 2: #60. Stage 3 (API break): #61.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions