mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Wrap custom datastore with metrics and validator (#1002)
* Wrap method added to datastore * datastore formatting fixed
This commit is contained in:
committed by
Tolga Ceylan
parent
3508378b8f
commit
ccde0d2357
@@ -18,7 +18,11 @@ func New(ctx context.Context, dbURL string) (models.Datastore, error) {
|
|||||||
return nil, err
|
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) {
|
func newds(ctx context.Context, dbURL string) (models.Datastore, error) {
|
||||||
|
|||||||
@@ -325,7 +325,7 @@ func WithNodeCertAuthority(ca string) ServerOption {
|
|||||||
|
|
||||||
func WithDatastore(ds models.Datastore) ServerOption {
|
func WithDatastore(ds models.Datastore) ServerOption {
|
||||||
return func(ctx context.Context, s *Server) error {
|
return func(ctx context.Context, s *Server) error {
|
||||||
s.datastore = ds
|
s.datastore = datastore.Wrap(ds)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user