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
87eae203
Commit
87eae203
authored
8 years ago
by
Pawan Rawal
Browse files
Options
Downloads
Patches
Plain Diff
Adding documentation and refactoring to make sure lines don't exceed 80 chars.
parent
87955a74
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
query/query.go
+2
-0
2 additions, 0 deletions
query/query.go
server/main.go
+9
-2
9 additions, 2 deletions
server/main.go
with
11 additions
and
2 deletions
query/query.go
+
2
−
0
View file @
87eae203
...
...
@@ -289,6 +289,8 @@ func extract(r *task.Result) (*pb.Result, error) {
return
result
,
nil
}
// This method performs a pre traversal on a subgraph and converts it to a
// protocol buffer Graph Response.
func
(
g
*
SubGraph
)
PreTraverse
()
(
gr
*
pb
.
GraphResponse
,
rerr
error
)
{
gr
=
&
pb
.
GraphResponse
{}
if
len
(
g
.
query
)
==
0
{
...
...
This diff is collapsed.
Click to expand it.
server/main.go
+
9
−
2
View file @
87eae203
...
...
@@ -50,7 +50,8 @@ 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
(
"clientPort"
,
"9090"
,
"Port used to communicate with client on tcp"
)
var
clientPort
=
flag
.
String
(
"clientPort"
,
"9090"
,
"Port used to communicate with client."
)
var
numcpu
=
flag
.
Int
(
"numCpu"
,
runtime
.
NumCPU
(),
"Number of cores to be used by the process"
)
var
instanceIdx
=
flag
.
Uint64
(
"instanceIdx"
,
0
,
...
...
@@ -205,7 +206,11 @@ func queryHandler(w http.ResponseWriter, r *http.Request) {
// server is used to implement pb.DGraphServer
type
server
struct
{}
func
(
s
*
server
)
Query
(
ctx
context
.
Context
,
r
*
pb
.
GraphRequest
)
(
gr
*
pb
.
GraphResponse
,
rerr
error
)
{
// This method is used to execute the query and return the response to the
// client as a protocol buffer message.
func
(
s
*
server
)
Query
(
ctx
context
.
Context
,
r
*
pb
.
GraphRequest
)
(
*
pb
.
GraphResponse
,
error
)
{
gr
:=
*
pb
.
GraphResponse
{}
if
len
(
r
.
Query
)
==
0
{
glog
.
Error
(
"While reading query"
)
return
gr
,
fmt
.
Errorf
(
"Empty query"
)
...
...
@@ -245,6 +250,8 @@ func (s *server) Query(ctx context.Context, r *pb.GraphRequest) (gr *pb.GraphRes
return
gr
,
err
}
// This function register a DGraph grpc server on the address, which is used
// exchanging protocol buffer messages.
func
runGrpcServer
(
address
string
)
error
{
ln
,
err
:=
net
.
Listen
(
"tcp"
,
address
)
if
err
!=
nil
{
...
...
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