Skip to content

Commit 4fb7c24

Browse files
add GetFactory interface to hostcapabilities package (#12789)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description The GetFactory method is used by a few receivers in the contrib package (e.g. receiver_creator). This PR adds a new interface to the hostcapabilities package so it can be cast correctly from other packages/components. <!-- Issue number if applicable --> #### Link to tracking issue Fixes # <!--Describe what testing was performed and which tests were added.--> #### Testing <!--Describe the documentation added.--> #### Documentation <!--Please delete paragraphs that you did not use before submitting.--> --------- Co-authored-by: Jade Guiton <[email protected]>
1 parent 23c46ed commit 4fb7c24

File tree

3 files changed

+37
-3
lines changed

3 files changed

+37
-3
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: 'enhancement'
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
7+
component: service
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Adds the GetFactory interface to the hostcapabilities package
11+
12+
# One or more tracking issues or pull requests related to the change
13+
issues: [12789]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# Optional: The change log or logs in which this entry should be included.
21+
# e.g. '[user]' or '[user, api]'
22+
# Include 'user' if the change is relevant to end users.
23+
# Include 'api' if there is a change to a library API.
24+
# Default: '[user]'
25+
change_logs: [api]

service/hostcapabilities/interfaces.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,11 @@ type ModuleInfo interface {
2626
type ExposeExporters interface {
2727
GetExporters() map[pipeline.Signal]map[component.ID]component.Component
2828
}
29+
30+
// ComponentFactory is an interface that may be implemented by the host to
31+
// provide a component's factory
32+
type ComponentFactory interface {
33+
// GetFactory returns the component factory for the given
34+
// component type
35+
GetFactory(kind component.Kind, componentType component.Type) component.Factory
36+
}

service/internal/graph/host.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ import (
2222
)
2323

2424
var (
25-
_ component.Host = (*Host)(nil)
26-
_ hostcapabilities.ModuleInfo = (*Host)(nil)
27-
_ hostcapabilities.ExposeExporters = (*Host)(nil)
25+
_ component.Host = (*Host)(nil)
26+
_ hostcapabilities.ModuleInfo = (*Host)(nil)
27+
_ hostcapabilities.ExposeExporters = (*Host)(nil)
28+
_ hostcapabilities.ComponentFactory = (*Host)(nil)
2829
)
2930

3031
type Host struct {

0 commit comments

Comments
 (0)