Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
38 lines (31 sloc) 768 Bytes
package dockerplugin
import (
"time"
"go.pedge.io/pb/go/google/protobuf"
"go.pedge.io/proto/rpclog"
"golang.org/x/net/context"
)
type apiServer struct {
protorpclog.Logger
implements []string
}
func newAPIServer(implements []string) *apiServer {
return &apiServer{
protorpclog.NewLogger("dockerplugin.API"),
implements,
}
}
func (a *apiServer) Activate(_ context.Context, request *google_protobuf.Empty) (response *ActivateResponse, err error) {
defer func(start time.Time) { a.Log(request, response, err, time.Since(start)) }(time.Now())
return &ActivateResponse{
Implements: copyStringSlice(a.implements),
}, nil
}
func copyStringSlice(s []string) []string {
if s == nil {
return nil
}
c := make([]string, len(s))
copy(c, s)
return c
}