forked from pachyderm/pachyderm
/
server.go
41 lines (37 loc) · 1.07 KB
/
server.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package server
import (
"sync"
"github.com/pachyderm/pachyderm/src/client/pkg/shard"
ppsclient "github.com/pachyderm/pachyderm/src/client/pps"
ppsserver "github.com/pachyderm/pachyderm/src/server/pps"
"go.pedge.io/proto/rpclog"
kube "k8s.io/kubernetes/pkg/client/unversioned"
)
type APIServer interface {
ppsclient.APIServer
ppsserver.InternalJobAPIServer
shard.Frontend
shard.Server
}
func NewAPIServer(
hasher *ppsserver.Hasher,
address string,
kubeClient *kube.Client,
) APIServer {
return &apiServer{
Logger: protorpclog.NewLogger("pachyderm.ppsclient.API"),
hasher: hasher,
address: address,
pfsAPIClient: nil,
pfsClientOnce: sync.Once{},
persistAPIClient: nil,
persistClientOnce: sync.Once{},
kubeClient: kubeClient,
cancelFuncs: make(map[string]func()),
cancelFuncsLock: sync.Mutex{},
shardCancelFuncs: make(map[uint64]func()),
shardCancelFuncsLock: sync.Mutex{},
version: shard.InvalidVersion,
versionLock: sync.RWMutex{},
}
}