ozontech / ozontech/insane-json

Feature: add function to deep copy a node from one decoder to a node from another

Open
#22 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
5
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Sometimes there is a need in creating a copy of JSON node subtree to another independent node to perform transformations. For this purpose it would be great to have a function to deep copy the whole data of one node to another node. There is a MutateToNode function which can do something familiar to copy, but it assigns pointers to nodes which can cause unplanned mutations. Also, when a node from one decoder is copied to a node from another via MutateToNode, if the fist node is released, its decoder is returned to pool and is prepared to be collected by GC, it might not be freed because the pointers to nodes from its pool are used in a node from another decoder and it can lead to memory leaks.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing MutateToNode function and the node and decoder ownership behavior it relies on. Trace how decoder pooling and node pointers interact, then define the deep-copy entry point so a subtree copied between decoders remains independent after the source decoder is released; verify that no source nodes or pooled decoder state are retained.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.