sshpoke/internal/server/driver/null/driver.go

36 lines
900 B
Go
Raw Normal View History

2023-11-17 20:39:00 +03:00
package null
import (
"context"
"github.com/Neur0toxine/sshpoke/internal/config"
"github.com/Neur0toxine/sshpoke/internal/logger"
"github.com/Neur0toxine/sshpoke/internal/server/driver/iface"
"github.com/Neur0toxine/sshpoke/pkg/dto"
2023-11-17 20:39:00 +03:00
)
// Null driver only logs container events to debug log. It is used when user provides invalid driver type.
// You can use it directly, but it won't do anything, so... why bother?
type Null struct {
name string
}
func New(ctx context.Context, name string, params config.DriverParams) (iface.Driver, error) {
return &Null{name: name}, nil
}
func (d *Null) Handle(event dto.Event) error {
2023-11-17 20:39:00 +03:00
logger.Sugar.Debugw("handling event with null driver", "serverName", d.name, "event", event)
return nil
}
func (d *Null) Name() string {
return d.name
}
2023-11-17 20:39:00 +03:00
func (d *Null) Driver() config.DriverType {
return config.DriverNull
}
func (d *Null) WaitForShutdown() {}