Skip to content
This repository was archived by the owner on Aug 11, 2021. It is now read-only.
This repository was archived by the owner on Aug 11, 2021. It is now read-only.

Passing in codecs instead of identifiers #197

@vmx

Description

@vmx

The current API takes multicodec codes as parameter for formats. @Gozala proposes #191 (comment) to pass in codec instances:

I find passing name / code of the codec counter intuitive & I think just providing a codec instance might be better for following reasons:

  1. Type checkers / linters can catch mismatching / invalid references, but are useless with names.
  2. If codec has not being installed you get an error, while with say dag.put(node, dag.codec[name]) you are encourage to see if format is known.
  3. Don't necessarily need to install codec to use it.

I understand that without installing a codec / format decode will not work, however get could optionally take codec as well. In case of putMany / getMany it's less clear but maybe optional codec dict can be provided as in {[name]:Codec}.

Not a big deal, just in my code I find it more convenient to pass actual codecs than names.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions