Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dgraph
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
dgraph
Commits
2a18c933
Commit
2a18c933
authored
9 years ago
by
Pawan Rawal
Browse files
Options
Downloads
Patches
Plain Diff
Verifying rpc works
Also query is now input as a flag in the client
parent
fb8f45da
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
client/go/main.go
+3
-12
3 additions, 12 deletions
client/go/main.go
server/main.go
+5
-2
5 additions, 2 deletions
server/main.go
with
8 additions
and
14 deletions
client/go/main.go
+
3
−
12
View file @
2a18c933
...
...
@@ -21,7 +21,6 @@ import (
"fmt"
"golang.org/x/net/context"
"google.golang.org/grpc"
"github.com/dgraph-io/dgraph/query/pb"
...
...
@@ -30,18 +29,10 @@ import (
var
glog
=
x
.
Log
(
"client"
)
var
port
=
flag
.
String
(
"port"
,
"9090"
,
"Port to communicate with server"
)
var
query
=
flag
.
String
(
"query"
,
""
,
"Query sent to the server"
)
func
main
()
{
// TODO(pawan) - Remove hardcoded query. Give helper methods to user for building query.
var
q0
=
`{
me(_xid_: m.0f4vbz) {
type.object.name.en
film.actor.film {
type.object.name.en
}
}
}`
flag
.
Parse
()
// TODO(pawan): Pick address for server from config
conn
,
err
:=
grpc
.
Dial
(
"127.0.0.1:"
+*
port
,
grpc
.
WithInsecure
())
if
err
!=
nil
{
...
...
@@ -51,7 +42,7 @@ func main() {
c
:=
pb
.
NewDGraphClient
(
conn
)
r
,
err
:=
c
.
Get
Graph
Response
(
context
.
Background
(),
&
pb
.
GraphRequest
{
Query
:
q0
})
r
,
err
:=
c
.
GetResponse
(
context
.
Background
(),
&
pb
.
GraphRequest
{
Query
:
*
query
})
if
err
!=
nil
{
x
.
Err
(
glog
,
err
)
.
Fatal
(
"Error in getting response from server"
)
}
...
...
This diff is collapsed.
Click to expand it.
server/main.go
+
5
−
2
View file @
2a18c933
...
...
@@ -50,7 +50,7 @@ var postingDir = flag.String("postings", "", "Directory to store posting lists")
var
uidDir
=
flag
.
String
(
"uids"
,
""
,
"XID UID posting lists directory"
)
var
mutationDir
=
flag
.
String
(
"mutations"
,
""
,
"Directory to store mutations"
)
var
port
=
flag
.
String
(
"port"
,
"8080"
,
"Port to run server on."
)
var
clientPort
=
flag
.
String
(
"
p
ort"
,
"9090"
,
"Port used to communicate with client on tcp"
)
var
clientPort
=
flag
.
String
(
"
clientP
ort"
,
"9090"
,
"Port used to communicate with client on tcp"
)
var
numcpu
=
flag
.
Int
(
"numCpu"
,
runtime
.
NumCPU
(),
"Number of cores to be used by the process"
)
var
instanceIdx
=
flag
.
Uint64
(
"instanceIdx"
,
0
,
...
...
@@ -256,7 +256,10 @@ func runServerForClient(address string) error {
s
:=
grpc
.
NewServer
()
pb
.
RegisterDGraphServer
(
s
,
&
server
{})
s
.
Serve
(
ln
)
if
err
=
s
.
Serve
(
ln
);
err
!=
nil
{
glog
.
Fatalf
(
"While serving gRpc requests"
,
err
)
}
return
nil
}
func
main
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment