storj/pkg/process/func.go
JT Olio 22b1fe4e21 pkg/process: add pkg/telemetry plumbing (#47)
* pkg/process: add pkg/telemetry plumbing

* pkg/process: add debug endpoints

* fix linting
2018-05-30 10:03:44 -04:00

28 lines
861 B
Go

// Copyright (C) 2018 Storj Labs, Inc.
// See LICENSE for copying information.
package process
import (
"context"
"go.uber.org/zap"
monkit "gopkg.in/spacemonkeygo/monkit.v2"
)
// ServiceFunc allows one to implement a Service in terms of simply the Process
// method
type ServiceFunc func(context.Context) error
// Process implements the Service interface and simply calls f
func (f ServiceFunc) Process(ctx context.Context) error { return f(ctx) }
// SetLogger implements the Service interface but is a no-op
func (f ServiceFunc) SetLogger(*zap.Logger) error { return nil }
// SetMetricHandler implements the Service interface but is a no-op
func (f ServiceFunc) SetMetricHandler(*monkit.Registry) error { return nil }
// InstanceID implements the Service interface and expects default behavior
func (f ServiceFunc) InstanceID() string { return "" }