32 lines
860 B
Go
32 lines
860 B
Go
package null
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/Neur0toxine/sshpoke/internal/config"
|
|
"github.com/Neur0toxine/sshpoke/internal/logger"
|
|
"github.com/Neur0toxine/sshpoke/internal/model"
|
|
"github.com/Neur0toxine/sshpoke/internal/server/driver/iface"
|
|
)
|
|
|
|
// 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 model.Event) error {
|
|
logger.Sugar.Debugw("handling event with null driver", "serverName", d.name, "event", event)
|
|
return nil
|
|
}
|
|
|
|
func (d *Null) Driver() config.DriverType {
|
|
return config.DriverNull
|
|
}
|
|
|
|
func (d *Null) WaitForShutdown() {}
|