Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move datanode to internal/node #82

Merged
merged 2 commits into from
Dec 3, 2024
Merged

move datanode to internal/node #82

merged 2 commits into from
Dec 3, 2024

Conversation

ryanfkeepers
Copy link
Contributor

Clues has grown organically into a split between the api that places data in the right spot (clues) and the structure which contains the data (nodes). As we move more behavior into subpackages, and as we look forward to future subpackage additions, it makes the most sense to move the node systems into an internal package so that they can be generically utilized across all clues subpackages without issues like import cycles.

This movement is 80% copy/paste, 19% renaming and reorganization, and 1% interface/import adaptation. No logical changes were intended.

  • copy/paste: datanode.go has moved into /internal/node/node.go. otel.go has moved into /internal/node/otel.go.
  • reorganization: datanode.go has been broken into multiple files. Discrete concerns (comments, agents, otel) all exist as various files within /node. Generic and basic functionality stays in /node/node.go.
  • adaptation: OTELConfig now has a user-facing config builder in /clues/otel.go, while the core otel config struct still lives in /internal/node/otel.go.

Clues has grown organically into a split between the api that places data in the right spot (clues) and the structure which contains the data (nodes). As we move more behavior into subpackages, and as we look forward to future subpackage additions, it makes the most sense to move the node systems into an internal package so that they can be generically utilized across all clues subpackages without issues like import cycles.

This movement is 80% copy/paste, 19% renaming and reorganization, and 1% interface/import adaptation. No logical changes were intended.

    copy/paste: datanode.go has moved into /internal/node/node.go. otel.go has moved into /internal/node/otel.go.
    reorganization: datanode.go has been broken into multiple files. Discrete concerns (comments, agents, otel) all exist as various files within /node. Generic and basic functionality stays in /node/node.go.
    adaptation: OTELConfig now has a user-facing config builder in /clues/otel.go, while the core otel config struct still lives in /internal/node/otel.go.
clues.go Outdated
// ---------------------------------------------------------------------------

// In retrieves the clues structured data from the context.
// TODO: turn return an interface instead of a node, have nodes

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// TODO: turn return an interface instead of a node, have nodes
// TODO: return an interface instead of a node, have nodes

}

// AddComment creates a new nodewith a comment but no other properties.
func (dn *Node) AddComment(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that TestAddComment exists but in clues_test.go. Could you move it to comments_test.go file in a future PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can do!

Split the clues interface between context management and error handling
by moving all error functionality to a new subpackage: /clerr.

This change is 80% copy/paste, and 20% renaming/reorganization. No
logical changes are intended.

* `copy/paste`: all error stuffs have been moved to /clerr. Since error
tests and clues tests shared a common test framework, that framework has
moved to /internal/tester to be available for both.
* 'reorganization': the err.go file has been split into a couple files,
primarily cluerr.go (the public interface) and err.go (the backing
struct). Extensions like comments and labels have moved into their own
file.
@ryanfkeepers ryanfkeepers merged commit 30e3f6a into main Dec 3, 2024
1 check passed
@ryanfkeepers ryanfkeepers deleted the internal-datanode branch December 3, 2024 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants