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

rename gather to relay #54

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions clues.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,12 @@ func AddCommentTo(
// ---------------------------------------------------------------------------

// AddAgent adds an agent with a given name to the context. What's an agent?
// It's a special case info gatherer that you can spawn to collect clues for
// It's a special case data adder that you can spawn to collect clues for
// you. Unlike standard clues additions, you have to tell the agent exactly
// what data you want it to Gather() for you.
// what data you want it to Relay() for you.
//
// Agents are recorded in the current clues node and all of its descendants.
// Data gathered by the agent will appear as part of the standard data map,
// Data relayed by the agent will appear as part of the standard data map,
// namespaced by each agent.
//
// Agents are specifically handy in a certain set of uncommon cases where
Expand All @@ -220,10 +220,10 @@ func AddAgent(
return setDefaultNodeInCtx(ctx, nn)
}

// Gather adds all key-value pairs to the provided agent. The agent will
// record those values to the dataNode in which it was created. All gathered
// Relay adds all key-value pairs to the provided agent. The agent will
// record those values to the dataNode in which it was created. All relayed
// values are namespaced to the owning agent.
func Gather(
func Relay(
ctx context.Context,
agent string,
vs ...any,
Expand Down
8 changes: 4 additions & 4 deletions clues_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -708,8 +708,8 @@ func TestAddAgent(t *testing.T) {
}, true)

ctxWithWit := clues.AddAgent(ctx, "wit")
clues.Gather(ctx, "wit", "zero", 0)
clues.Gather(ctxWithWit, "wit", "two", 2)
clues.Relay(ctx, "wit", "zero", 0)
clues.Relay(ctxWithWit, "wit", "two", 2)

mapEquals(t, ctx, msa{
"one": 1,
Expand All @@ -725,7 +725,7 @@ func TestAddAgent(t *testing.T) {
}, true)

ctxWithTim := clues.AddAgent(ctxWithWit, "tim")
clues.Gather(ctxWithTim, "tim", "three", 3)
clues.Relay(ctxWithTim, "tim", "three", 3)

mapEquals(t, ctx, msa{
"one": 1,
Expand All @@ -744,7 +744,7 @@ func TestAddAgent(t *testing.T) {
}, true)

ctxWithBob := clues.AddAgent(ctx, "bob")
clues.Gather(ctxWithBob, "bob", "four", 4)
clues.Relay(ctxWithBob, "bob", "four", 4)

mapEquals(t, ctx, msa{
"one": 1,
Expand Down
2 changes: 1 addition & 1 deletion datanode.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ type dataNode struct {
// from leaf to root when looking for populated labelCounters.
labelCounter Adder

// agents act as proxy dataNodes that can gather specific, intentional data
// agents act as proxy dataNodes that can relay specific, intentional data
// additions. They're namespaced so that additions to the agents don't accidentally
// clobber other values in the dataNode. This also allows agents to protect
// variations of data from each other, in case users need to compare differences
Expand Down
Loading