summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/clients/handlers/healthhandler.go2
-rw-r--r--internal/config/server.go1
-rw-r--r--internal/io/signal/signal.go2
-rw-r--r--internal/mapr/server/aggregate.go1
-rw-r--r--internal/regex/flag.go2
-rw-r--r--internal/regex/regex.go7
-rw-r--r--internal/server/continuous.go2
-rw-r--r--internal/server/handlers/controlhandler.go2
-rw-r--r--internal/server/handlers/serverhandler.go2
-rw-r--r--internal/server/scheduler.go2
10 files changed, 20 insertions, 3 deletions
diff --git a/internal/clients/handlers/healthhandler.go b/internal/clients/handlers/healthhandler.go
index 95693ab..08ed137 100644
--- a/internal/clients/handlers/healthhandler.go
+++ b/internal/clients/handlers/healthhandler.go
@@ -45,10 +45,12 @@ func (h *HealthHandler) Status() int {
return h.status
}
+// Done returns done channel of the handler.
func (h *HealthHandler) Done() <-chan struct{} {
return h.done.Done()
}
+// Shutdown the handler.
func (h *HealthHandler) Shutdown() {
h.done.Shutdown()
}
diff --git a/internal/config/server.go b/internal/config/server.go
index db12cec..dc0d587 100644
--- a/internal/config/server.go
+++ b/internal/config/server.go
@@ -61,6 +61,7 @@ type ServerConfig struct {
Continuous []Continuous `json:",omitempty"`
}
+// ServerRelaxedAuthEnable should be used for development and testing purposes only.
var ServerRelaxedAuthEnable bool
// Create a new default server configuration.
diff --git a/internal/io/signal/signal.go b/internal/io/signal/signal.go
index 27c7852..500c530 100644
--- a/internal/io/signal/signal.go
+++ b/internal/io/signal/signal.go
@@ -10,7 +10,7 @@ import (
"github.com/mimecast/dtail/internal/config"
)
-// StatsCh returns a channel for "please print stats" signalling.
+// InterruptCh returns a channel for "please print stats" signalling.
func InterruptCh(ctx context.Context) <-chan string {
sigIntCh := make(chan os.Signal)
gosignal.Notify(sigIntCh, os.Interrupt)
diff --git a/internal/mapr/server/aggregate.go b/internal/mapr/server/aggregate.go
index cd59b63..28bb074 100644
--- a/internal/mapr/server/aggregate.go
+++ b/internal/mapr/server/aggregate.go
@@ -80,6 +80,7 @@ func NewAggregate(queryStr string) (*Aggregate, error) {
return &a, nil
}
+// Shutdown the aggregation engine.
func (a *Aggregate) Shutdown() {
a.Flush()
a.done.Shutdown()
diff --git a/internal/regex/flag.go b/internal/regex/flag.go
index d3ff712..396bda0 100644
--- a/internal/regex/flag.go
+++ b/internal/regex/flag.go
@@ -2,6 +2,7 @@ package regex
import "fmt"
+// Flag for regex.
type Flag int
const (
@@ -15,6 +16,7 @@ const (
Noop Flag = iota
)
+// NewFlag returns a new regex flag.
func NewFlag(str string) (Flag, error) {
switch str {
case "default":
diff --git a/internal/regex/regex.go b/internal/regex/regex.go
index f668c38..2561659 100644
--- a/internal/regex/regex.go
+++ b/internal/regex/regex.go
@@ -8,6 +8,7 @@ import (
"github.com/mimecast/dtail/internal/io/logger"
)
+// Regex for filtering lines.
type Regex struct {
// The original regex string
regexStr string
@@ -24,6 +25,7 @@ func (r Regex) String() string {
r.regexStr, r.flags, r.initialized, r.re == nil)
}
+// NewNoop is a noop regex (doing nothing).
func NewNoop() Regex {
return Regex{
flags: []Flag{Noop},
@@ -31,6 +33,7 @@ func NewNoop() Regex {
}
}
+// New returns a new regex object.
func New(regexStr string, flag Flag) (Regex, error) {
if regexStr == "" || regexStr == "." || regexStr == ".*" {
return NewNoop(), nil
@@ -59,6 +62,7 @@ func new(regexStr string, flags []Flag) (Regex, error) {
return r, nil
}
+// Match a byte string.
func (r Regex) Match(bytes []byte) bool {
switch r.flags[0] {
case Default:
@@ -72,6 +76,7 @@ func (r Regex) Match(bytes []byte) bool {
}
}
+// MatchString matches a string.
func (r Regex) MatchString(str string) bool {
switch r.flags[0] {
case Default:
@@ -85,6 +90,7 @@ func (r Regex) MatchString(str string) bool {
}
}
+// Serialize the regex.
func (r Regex) Serialize() string {
var flags []string
for _, flag := range r.flags {
@@ -98,6 +104,7 @@ func (r Regex) Serialize() string {
return fmt.Sprintf("regex:%s %s", strings.Join(flags, ","), r.regexStr)
}
+// Deserialize the regex.
func Deserialize(str string) (Regex, error) {
// Get regex string
s := strings.SplitN(str, " ", 2)
diff --git a/internal/server/continuous.go b/internal/server/continuous.go
index 583d136..f75c732 100644
--- a/internal/server/continuous.go
+++ b/internal/server/continuous.go
@@ -92,7 +92,7 @@ func (c *continuous) runJob(ctx context.Context, job config.Continuous) {
}
logger.Info(fmt.Sprintf("Starting job %s", job.Name))
- status := client.Start(jobCtx, make(chan struct{}))
+ status := client.Start(jobCtx, make(chan string))
logMessage := fmt.Sprintf("Job exited with status %d", status)
if status != 0 {
diff --git a/internal/server/handlers/controlhandler.go b/internal/server/handlers/controlhandler.go
index 9a8eb75..8cc5a40 100644
--- a/internal/server/handlers/controlhandler.go
+++ b/internal/server/handlers/controlhandler.go
@@ -41,10 +41,12 @@ func NewControlHandler(user *user.User) *ControlHandler {
return &h
}
+// Shutdown the handler.
func (h *ControlHandler) Shutdown() {
h.done.Shutdown()
}
+// Done channel of the handler.
func (h *ControlHandler) Done() <-chan struct{} {
return h.done.Done()
}
diff --git a/internal/server/handlers/serverhandler.go b/internal/server/handlers/serverhandler.go
index 843eabc..5cf8041 100644
--- a/internal/server/handlers/serverhandler.go
+++ b/internal/server/handlers/serverhandler.go
@@ -72,10 +72,12 @@ func NewServerHandler(user *user.User, catLimiter, tailLimiter, globalServerWait
return &h
}
+// Shutdown the handler.
func (h *ServerHandler) Shutdown() {
h.done.Shutdown()
}
+// Done channel of the handler.
func (h *ServerHandler) Done() <-chan struct{} {
return h.done.Done()
}
diff --git a/internal/server/scheduler.go b/internal/server/scheduler.go
index 9d76a3b..a1e9e36 100644
--- a/internal/server/scheduler.go
+++ b/internal/server/scheduler.go
@@ -93,7 +93,7 @@ func (s *scheduler) runJobs(ctx context.Context) {
defer cancel()
logger.Info(fmt.Sprintf("Starting job %s", job.Name))
- status := client.Start(jobCtx, make(chan struct{}))
+ status := client.Start(jobCtx, make(chan string))
logMessage := fmt.Sprintf("Job exited with status %d", status)
if status != 0 {