Skip to content

Define data size constants #571

@efiacor

Description

@efiacor

Status: Not started

Data size constants are expressed as raw arithmetic (6 * 1024 * 1024) and flags accept raw byte counts (--max-grpc-message-size=6291456). This is error-prone and hard to read.

Add a small utility (or adopt an existing lib like github.com/c2h5oh/datasize) that provides:

  • Named constants: datasize.MB(6) instead of 6 * 1024 * 1024
  • String parsing for flags: --max-grpc-message-size=6MB instead of raw bytes
  • Similar ergonomics to the time package's time.Duration / time.ParseDuration

Current usage: defaultMaxGRPCMessageSize in controllers/packagerevisions/pkg/controllers/packagerevision/config.go. More usages likely as the codebase grows (DB limits, PRR size thresholds, etc).

Acceptance Criteria:

  • Data size constants use named helpers (e.g. datasize.MB(6))
  • Flags accept human-readable strings (e.g. 6MB, 512KB)
  • Existing --max-grpc-message-size flag updated

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions