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.

Make dag-pb an immutable 'class' #4

@daviddias

Description

@daviddias

It is very cumbersome to use DAGNode class in the way it was designed originally, specially now with the async crypto constraints that require a callback to mutate state mutation on each instance (literally, bleh).

I would like to make the strong case to make the methods of this DAGNode class actually function present in the dagPB.util, so that any mutation returns an instance of a new instance.

Benefits:

  • no more node.multihash((err, multihash) => {})
  • no more node.toJSON((err, nodeJSON) => {})
  • more of node.multihash (calculate once, use it every time)
  • more of node.json (calculate once, use it every time)

//cc @haadcode @dignifiedquire @victorbjelkholm

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