Skip to content

[Context]: add Ordered/Unordered result ordering control #24

Description

@rian-be

Summary

Add Ordered vs Unordered result ordering control for map-style batch operations.

Goal

Let consumers choose, per call: stable predictable ordering (results[5]items[5], default) or lower-latency streaming order (Unordered).

Reasoning & Build

Ordered (default)

  • Predictability; higher memory cost (results buffered to retain index order).

Unordered (opt-in)

  • Lower latency ("streaming"); results returned/yielded as soon as they finish.

  • Snapshot-internal use: DB insert where order is irrelevant.

  • Ordered and Unordered modes surfaced on the relevant batch/map primitives.

  • Unordered streams results as they complete (lowest latency).

  • Ordered buffers to preserve input index mapping.

  • Unit tests for both modes' contract + memory tradeoff note.

Design Expectations

  • Ordered is the default; Unordered is clearly opt-in.
  • Composes with MapParallel (chunking ordering) and map APIs.

Acceptance Criteria

  • Default path preserves input order.
  • Unordered path returns as soon as items finish.
  • Ordering choice has no impact on context isolation.

Non-Goals

  • No reordering semantics beyond index stability / streaming.

Metadata

Metadata

Assignees

No one assigned

    Labels

    concurrencyParallel / batch / async executionenhancementNew feature or requestextensionExtension behaviors / helpers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions