database: fix build

This commit is contained in:
Cadey Ratio 2017-04-28 19:51:49 -07:00
parent 6fc2e13e54
commit d6da19c063
3 changed files with 27 additions and 5 deletions

View File

@ -60,11 +60,11 @@ func (b *BoltDBStorage) GetRoute(ctx context.Context, host string) (Route, error
switch err {
case storm.ErrNotFound:
return errors.Wrapf(err, "%v", ErrNoSuchRoute)
case storm.AlreadyExists:
return errors.Wrapf(err, "%v", ErrRouteAlreadyExists)
return Route{}, errors.Wrapf(err, "%v", ErrNoSuchRoute)
case storm.ErrAlreadyExists:
return Route{}, errors.Wrapf(err, "%v", ErrRouteAlreadyExists)
default:
return errors.Wrapf(err, "%v", ErrUnknown)
return Route{}, errors.Wrapf(err, "%v", ErrUnknown)
}
}

22
database/cert.go Normal file
View File

@ -0,0 +1,22 @@
package database
// CryptoLevel indicates what form of cryptography the certificate is stored
// with.
type CryptoLevel int
// Crypto levels / strategies defined
const (
// NOTE: this is defined for debugging / testing usage only
CryptoLevelNone CryptoLevel = iota
// Use the global set of secretbox keys
CryptoLevelSecretbox
)
// CachedCert is an individual cached certificate in the database.
type CachedCert struct {
Key string `gorethink:"id" storm:"id"`
CryptoLevel CryptoLevel `gorethink:"cryptoLevel"`
// PEM-encoded bytes with the above crypto level as a filter.
Body []byte `gorethink:"body"`
}

View File

@ -9,7 +9,7 @@ import (
type Storage interface {
// routes
GetRoute(ctx context.Context, host string) (Route, error)
GetAllRoutes(ctx context.Context) ([]Route, error)
GetAllRoutes(ctx context.Context, user string) ([]Route, error)
PutRoute(ctx context.Context, domain, kind string) (Route, error)
DeleteRoute(ctx context.Context, id string) error