Wrap custom datastore with metrics and validator (#1002)

* Wrap method added to datastore

* datastore formatting fixed
This commit is contained in:
Tomas Knappek
2018-05-17 13:21:36 -07:00
committed by Tolga Ceylan
parent 3508378b8f
commit ccde0d2357
2 changed files with 6 additions and 2 deletions

View File

@@ -18,7 +18,11 @@ func New(ctx context.Context, dbURL string) (models.Datastore, error) {
return nil, err
}
return datastoreutil.MetricDS(datastoreutil.NewValidator(ds)), nil
return Wrap(ds), nil
}
func Wrap(ds models.Datastore) models.Datastore {
return datastoreutil.MetricDS(datastoreutil.NewValidator(ds))
}
func newds(ctx context.Context, dbURL string) (models.Datastore, error) {

View File

@@ -325,7 +325,7 @@ func WithNodeCertAuthority(ca string) ServerOption {
func WithDatastore(ds models.Datastore) ServerOption {
return func(ctx context.Context, s *Server) error {
s.datastore = ds
s.datastore = datastore.Wrap(ds)
return nil
}
}