-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathcompose_cluster.go
More file actions
65 lines (52 loc) · 1.65 KB
/
compose_cluster.go
File metadata and controls
65 lines (52 loc) · 1.65 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
* SPDX-FileCopyrightText: © Hypermode Inc. <[email protected]>
* SPDX-License-Identifier: Apache-2.0
*/
package dgraphtest
import (
"github.com/dgraph-io/dgo/v250"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"github.com/hypermodeinc/dgraph/v24/dgraphapi"
"github.com/hypermodeinc/dgraph/v24/testutil"
)
type ComposeCluster struct{}
func NewComposeCluster() *ComposeCluster {
return &ComposeCluster{}
}
func (c *ComposeCluster) Client() (*dgraphapi.GrpcClient, func(), error) {
dg, err := dgo.NewClient(testutil.SockAddr,
dgo.WithGrpcOption(grpc.WithTransportCredentials(insecure.NewCredentials())))
if err != nil {
return nil, nil, err
}
return &dgraphapi.GrpcClient{Dgraph: dg}, func() { dg.Close() }, nil
}
// HTTPClient creates an HTTP client
func (c *ComposeCluster) HTTPClient() (*dgraphapi.HTTPClient, error) {
httpClient, err := dgraphapi.GetHttpClient(testutil.SockAddrHttp, testutil.SockAddrZeroHttp)
if err != nil {
return nil, err
}
httpClient.HttpToken = &dgraphapi.HttpToken{}
return httpClient, nil
}
func (c *ComposeCluster) AlphasHealth() ([]string, error) {
return nil, errNotImplemented
}
func (c *ComposeCluster) AlphasLogs() ([]string, error) {
return nil, errNotImplemented
}
func (c *ComposeCluster) AssignUids(client *dgo.Dgraph, num uint64) error {
return testutil.AssignUids(num)
}
func (c *ComposeCluster) GetVersion() string {
return localVersion
}
func (c *ComposeCluster) GetEncKeyPath() (string, error) {
return "", errNotImplemented
}
// GetRepoDir returns the repositroty directory of the cluster
func (c *ComposeCluster) GetRepoDir() (string, error) {
return "", errNotImplemented
}