Skip to content

refactor: Let EncodingFactory be an instantiable class#607

Closed
tanjialiang wants to merge 1 commit intofacebookincubator:mainfrom
tanjialiang:export-D97367204
Closed

refactor: Let EncodingFactory be an instantiable class#607
tanjialiang wants to merge 1 commit intofacebookincubator:mainfrom
tanjialiang:export-D97367204

Conversation

@tanjialiang
Copy link
Copy Markdown
Contributor

@tanjialiang tanjialiang commented Mar 23, 2026

Summary:

Introduce encoding::Decoder class that bundles a decode function with
Encoding::Options into a single object. This replaces the pattern of
threading a bare std::function encoding factory through multiple layers
(NimbleData, ChunkedDecoder, NimbleParams).

Named constructors:

  • encoding::Decoder::create(Options) — uses EncodingFactory::decode
  • encoding::Decoder::createLegacy(Options) — uses legacy::EncodingFactory::decode

This is a pure refactoring with no behavioral change. It simplifies the
selective reader code by replacing 10+ line inline lambda ternaries with
concise encoding::Decoder::create() / createLegacy() calls, and
prepares the codebase for threading additional options (like varint row
counts) without touching every callsite.

The Decoder class lives in namespace facebook::nimble::encoding and in a
separate BUCK target (encoding_decoder) to avoid a circular dependency
between encodings and legacy/encodings.

Reviewed By: xiaoxmeng

Differential Revision: D97367204

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Mar 23, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync bot commented Mar 23, 2026

@tanjialiang has exported this pull request. If you are a Meta employee, you can view the originating Diff in D97367204.

@meta-codesync meta-codesync bot changed the title Introduce encoding::Decoder to bundle encoding factory with options Introduce encoding::Decoder to bundle encoding factory with options (#607) Mar 24, 2026
tanjialiang added a commit to tanjialiang/nimble that referenced this pull request Mar 24, 2026
…acebookincubator#607)

Summary:

Introduce `encoding::Decoder` class that bundles a decode function with
`Encoding::Options` into a single object. This replaces the pattern of
threading a bare `std::function` encoding factory through multiple layers
(`NimbleData`, `ChunkedDecoder`, `NimbleParams`).

Named constructors:
- `encoding::Decoder::create(Options)` — uses `EncodingFactory::decode`
- `encoding::Decoder::createLegacy(Options)` — uses `legacy::EncodingFactory::decode`

This is a pure refactoring with no behavioral change. It simplifies the
selective reader code by replacing 10+ line inline lambda ternaries with
concise `encoding::Decoder::create()` / `createLegacy()` calls, and
prepares the codebase for threading additional options (like varint row
counts) without touching every callsite.

The `Decoder` class lives in `namespace facebook::nimble::encoding` and in a
separate BUCK target (`encoding_decoder`) to avoid a circular dependency
between `encodings` and `legacy/encodings`.

Differential Revision: D97367204
@meta-codesync meta-codesync bot changed the title Introduce encoding::Decoder to bundle encoding factory with options (#607) Let EncodingFactory be an instantiable class (#607) Mar 25, 2026
tanjialiang added a commit to tanjialiang/nimble that referenced this pull request Mar 25, 2026
Summary:
Pull Request resolved: facebookincubator#607

Introduce `encoding::Decoder` class that bundles a decode function with
`Encoding::Options` into a single object. This replaces the pattern of
threading a bare `std::function` encoding factory through multiple layers
(`NimbleData`, `ChunkedDecoder`, `NimbleParams`).

Named constructors:
- `encoding::Decoder::create(Options)` — uses `EncodingFactory::decode`
- `encoding::Decoder::createLegacy(Options)` — uses `legacy::EncodingFactory::decode`

This is a pure refactoring with no behavioral change. It simplifies the
selective reader code by replacing 10+ line inline lambda ternaries with
concise `encoding::Decoder::create()` / `createLegacy()` calls, and
prepares the codebase for threading additional options (like varint row
counts) without touching every callsite.

The `Decoder` class lives in `namespace facebook::nimble::encoding` and in a
separate BUCK target (`encoding_decoder`) to avoid a circular dependency
between `encodings` and `legacy/encodings`.

Reviewed By: xiaoxmeng

Differential Revision: D97367204
@tanjialiang tanjialiang changed the title Let EncodingFactory be an instantiable class (#607) refactor: Let EncodingFactory be an instantiable class Mar 25, 2026
@meta-codesync meta-codesync bot changed the title refactor: Let EncodingFactory be an instantiable class Let EncodingFactory be an instantiable class (#607) Mar 26, 2026
tanjialiang added a commit to tanjialiang/nimble that referenced this pull request Mar 26, 2026
Summary:
Pull Request resolved: facebookincubator#607

Introduce `encoding::Decoder` class that bundles a decode function with
`Encoding::Options` into a single object. This replaces the pattern of
threading a bare `std::function` encoding factory through multiple layers
(`NimbleData`, `ChunkedDecoder`, `NimbleParams`).

Named constructors:
- `encoding::Decoder::create(Options)` — uses `EncodingFactory::decode`
- `encoding::Decoder::createLegacy(Options)` — uses `legacy::EncodingFactory::decode`

This is a pure refactoring with no behavioral change. It simplifies the
selective reader code by replacing 10+ line inline lambda ternaries with
concise `encoding::Decoder::create()` / `createLegacy()` calls, and
prepares the codebase for threading additional options (like varint row
counts) without touching every callsite.

The `Decoder` class lives in `namespace facebook::nimble::encoding` and in a
separate BUCK target (`encoding_decoder`) to avoid a circular dependency
between `encodings` and `legacy/encodings`.

Reviewed By: xiaoxmeng

Differential Revision: D97367204
tanjialiang added a commit to tanjialiang/nimble that referenced this pull request Mar 26, 2026
Summary:
Pull Request resolved: facebookincubator#607

Introduce `encoding::Decoder` class that bundles a decode function with
`Encoding::Options` into a single object. This replaces the pattern of
threading a bare `std::function` encoding factory through multiple layers
(`NimbleData`, `ChunkedDecoder`, `NimbleParams`).

Named constructors:
- `encoding::Decoder::create(Options)` — uses `EncodingFactory::decode`
- `encoding::Decoder::createLegacy(Options)` — uses `legacy::EncodingFactory::decode`

This is a pure refactoring with no behavioral change. It simplifies the
selective reader code by replacing 10+ line inline lambda ternaries with
concise `encoding::Decoder::create()` / `createLegacy()` calls, and
prepares the codebase for threading additional options (like varint row
counts) without touching every callsite.

The `Decoder` class lives in `namespace facebook::nimble::encoding` and in a
separate BUCK target (`encoding_decoder`) to avoid a circular dependency
between `encodings` and `legacy/encodings`.

Reviewed By: xiaoxmeng

Differential Revision: D97367204
tanjialiang added a commit to tanjialiang/nimble that referenced this pull request Mar 26, 2026
Summary:
Pull Request resolved: facebookincubator#607

Introduce `encoding::Decoder` class that bundles a decode function with
`Encoding::Options` into a single object. This replaces the pattern of
threading a bare `std::function` encoding factory through multiple layers
(`NimbleData`, `ChunkedDecoder`, `NimbleParams`).

Named constructors:
- `encoding::Decoder::create(Options)` — uses `EncodingFactory::decode`
- `encoding::Decoder::createLegacy(Options)` — uses `legacy::EncodingFactory::decode`

This is a pure refactoring with no behavioral change. It simplifies the
selective reader code by replacing 10+ line inline lambda ternaries with
concise `encoding::Decoder::create()` / `createLegacy()` calls, and
prepares the codebase for threading additional options (like varint row
counts) without touching every callsite.

The `Decoder` class lives in `namespace facebook::nimble::encoding` and in a
separate BUCK target (`encoding_decoder`) to avoid a circular dependency
between `encodings` and `legacy/encodings`.

Reviewed By: xiaoxmeng

Differential Revision: D97367204
tanjialiang added a commit to tanjialiang/nimble that referenced this pull request Mar 26, 2026
Summary:
Pull Request resolved: facebookincubator#607

Introduce `encoding::Decoder` class that bundles a decode function with
`Encoding::Options` into a single object. This replaces the pattern of
threading a bare `std::function` encoding factory through multiple layers
(`NimbleData`, `ChunkedDecoder`, `NimbleParams`).

Named constructors:
- `encoding::Decoder::create(Options)` — uses `EncodingFactory::decode`
- `encoding::Decoder::createLegacy(Options)` — uses `legacy::EncodingFactory::decode`

This is a pure refactoring with no behavioral change. It simplifies the
selective reader code by replacing 10+ line inline lambda ternaries with
concise `encoding::Decoder::create()` / `createLegacy()` calls, and
prepares the codebase for threading additional options (like varint row
counts) without touching every callsite.

The `Decoder` class lives in `namespace facebook::nimble::encoding` and in a
separate BUCK target (`encoding_decoder`) to avoid a circular dependency
between `encodings` and `legacy/encodings`.

Reviewed By: xiaoxmeng

Differential Revision: D97367204
Summary:
Pull Request resolved: facebookincubator#607

Introduce `encoding::Decoder` class that bundles a decode function with
`Encoding::Options` into a single object. This replaces the pattern of
threading a bare `std::function` encoding factory through multiple layers
(`NimbleData`, `ChunkedDecoder`, `NimbleParams`).

Named constructors:
- `encoding::Decoder::create(Options)` — uses `EncodingFactory::decode`
- `encoding::Decoder::createLegacy(Options)` — uses `legacy::EncodingFactory::decode`

This is a pure refactoring with no behavioral change. It simplifies the
selective reader code by replacing 10+ line inline lambda ternaries with
concise `encoding::Decoder::create()` / `createLegacy()` calls, and
prepares the codebase for threading additional options (like varint row
counts) without touching every callsite.

The `Decoder` class lives in `namespace facebook::nimble::encoding` and in a
separate BUCK target (`encoding_decoder`) to avoid a circular dependency
between `encodings` and `legacy/encodings`.

Reviewed By: xiaoxmeng

Differential Revision: D97367204
@tanjialiang tanjialiang changed the title Let EncodingFactory be an instantiable class (#607) refactor: Let EncodingFactory be an instantiable class Mar 26, 2026
@meta-codesync meta-codesync bot closed this in 44a28d9 Mar 27, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync bot commented Mar 27, 2026

This pull request has been merged in 44a28d9.

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

Labels

CLA Signed This label is managed by the Meta Open Source bot. fb-exported Merged meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants