48 lines
1.2 KiB
Go
48 lines
1.2 KiB
Go
package backend
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"git.thequux.com/thequux/ipasso/backend"
|
|
"go.uber.org/zap"
|
|
"net/url"
|
|
)
|
|
|
|
type NullBackend struct{}
|
|
|
|
func (n *NullBackend) PutSession(ctx context.Context, session backend.Session, cache backend.SessionCache) error {
|
|
//TODO implement me
|
|
zap.L().Info("Put session", zap.Any("session", session), zap.Any("cache", cache))
|
|
return nil
|
|
}
|
|
|
|
func (n *NullBackend) GetSession(ctx context.Context, id string) (backend.Session, *backend.SessionCache, error) {
|
|
//TODO implement me
|
|
return backend.Session{}, nil, errors.New("no such session")
|
|
}
|
|
|
|
func (n *NullBackend) EndSession(ctx context.Context, id string) {
|
|
//TODO implement me
|
|
}
|
|
|
|
func (n *NullBackend) ReserveSessionID(ctx context.Context, sessionID string) (bool, error) {
|
|
//TODO implement me
|
|
return false, nil
|
|
}
|
|
|
|
func (n *NullBackend) Ping(ctx context.Context) error {
|
|
//TODO implement me
|
|
return nil
|
|
}
|
|
|
|
func (n *NullBackend) DoMaintenance(ctx context.Context) {
|
|
//TODO implement me
|
|
}
|
|
|
|
func init() {
|
|
backend.RegisterBackendFactory("null", "Do-nothing backend. Probably not useful", "Usage: null://",
|
|
func(*url.URL) (backend.Backend, error) {
|
|
return &NullBackend{}, nil
|
|
})
|
|
}
|