Skip to content

Commit bed4b34

Browse files
author
Christian Muirhead
committed
Move constructors closer to type definition
1 parent b75b7cf commit bed4b34

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

apiserver/logsink.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ type agentLoggingStrategy struct {
5454
fileLogger io.Writer
5555
}
5656

57+
func newAgentLoggingStrategy(ctxt httpContext, fileLogger io.Writer) LoggingStrategy {
58+
return &agentLoggingStrategy{ctxt: ctxt, fileLogger: fileLogger}
59+
}
60+
5761
// Authenticate checks that this is request is from a machine
5862
// agent. Part of LoggingStrategy.
5963
func (s *agentLoggingStrategy) Authenticate(req *http.Request) error {
@@ -111,10 +115,6 @@ func (s *agentLoggingStrategy) Stop() {
111115
s.ctxt.release(s.st)
112116
}
113117

114-
func newAgentLoggingStrategy(ctxt httpContext, fileLogger io.Writer) LoggingStrategy {
115-
return &agentLoggingStrategy{ctxt: ctxt, fileLogger: fileLogger}
116-
}
117-
118118
func newLogSinkHandler(h httpContext, w io.Writer, newStrategy func(httpContext, io.Writer) LoggingStrategy) http.Handler {
119119
return &logSinkHandler{ctxt: h, fileLogger: w, newStrategy: newStrategy}
120120
}

apiserver/logtransfer.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ type migrationLoggingStrategy struct {
2424
fileLogger io.Writer
2525
}
2626

27+
func newMigrationLoggingStrategy(ctxt httpContext, fileLogger io.Writer) LoggingStrategy {
28+
return &migrationLoggingStrategy{ctxt: ctxt, fileLogger: fileLogger}
29+
}
30+
2731
// Authenticate checks that the user is a controller superuser and
2832
// that the requested model is migrating. Part of LoggingStrategy.
2933
func (s *migrationLoggingStrategy) Authenticate(req *http.Request) error {
@@ -71,7 +75,3 @@ func (s *migrationLoggingStrategy) Stop() {
7175
s.dbLogger.Close()
7276
s.ctxt.release(s.st)
7377
}
74-
75-
func newMigrationLoggingStrategy(ctxt httpContext, fileLogger io.Writer) LoggingStrategy {
76-
return &migrationLoggingStrategy{ctxt: ctxt, fileLogger: fileLogger}
77-
}

0 commit comments

Comments
 (0)