dgraph 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1fdd8b102063e8eb21e57d3d5ea3b9fc78acd4e0d2a626ad2719c49a857b646c
4
+ data.tar.gz: 5d41c100df3a427eda24d841c4b8087700dd72d19bb83b8d30482671acda8615
5
+ SHA512:
6
+ metadata.gz: 61ac087090f855b5a79a618f05331c11dce2c585c2adeb09473e95a0e8d155c184902058b16e77c5aba57fe2bc769c0be8185a65d78af018c0241f49e9bb636d
7
+ data.tar.gz: 7ccb14bb12dc90613352f9759bb662eb2e3749cc208cfa1512f435907d32234cfbfcd6c2b384c562b00973f2e31f5336c7dc6f3eee55f3e2f7d3bb3eec12afc5
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ .DS_Store
10
+ lib/.DS_Store
11
+ .byebug_history
data/.rubocop.yml ADDED
@@ -0,0 +1,8 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6.1
3
+ Exclude:
4
+ - 'lib/*_pb.rb'
5
+ - 'bin/*'
6
+
7
+ Metrics/LineLength:
8
+ Max: 150
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.6.1
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.1
7
+ before_install: gem install bundler -v 1.16.3
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at jihan2032@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ gem 'byebug'
8
+ gem 'rubocop'
9
+
10
+ # Specify your gem's dependencies in dgraph.gemspec
11
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,51 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ dgraph (0.1.0)
5
+ grpc
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.0)
11
+ byebug (11.0.0)
12
+ google-protobuf (3.7.0)
13
+ googleapis-common-protos-types (1.0.3)
14
+ google-protobuf (~> 3.0)
15
+ grpc (1.19.0)
16
+ google-protobuf (~> 3.1)
17
+ googleapis-common-protos-types (~> 1.0.0)
18
+ jaro_winkler (1.5.2)
19
+ minitest (5.11.3)
20
+ parallel (1.14.0)
21
+ parser (2.6.0.0)
22
+ ast (~> 2.4.0)
23
+ powerpack (0.1.2)
24
+ psych (3.1.0)
25
+ rainbow (3.0.0)
26
+ rake (10.5.0)
27
+ rubocop (0.65.0)
28
+ jaro_winkler (~> 1.5.1)
29
+ parallel (~> 1.10)
30
+ parser (>= 2.5, != 2.5.1.1)
31
+ powerpack (~> 0.1)
32
+ psych (>= 3.1.0)
33
+ rainbow (>= 2.2.2, < 4.0)
34
+ ruby-progressbar (~> 1.7)
35
+ unicode-display_width (~> 1.4.0)
36
+ ruby-progressbar (1.10.0)
37
+ unicode-display_width (1.4.1)
38
+
39
+ PLATFORMS
40
+ ruby
41
+
42
+ DEPENDENCIES
43
+ bundler (~> 1.16)
44
+ byebug
45
+ dgraph!
46
+ minitest (~> 5.0)
47
+ rake (~> 10.0)
48
+ rubocop
49
+
50
+ BUNDLED WITH
51
+ 1.17.2
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 jihan2032
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # Dgraph
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/dgraph`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'dgraph'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install dgraph
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/dgraph. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the Dgraph project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/dgraph/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rake/testtask'
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << 'test'
8
+ t.libs << 'lib'
9
+ t.test_files = FileList['test/**/*_test.rb']
10
+ end
11
+
12
+ task default: :test
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "dgraph"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/dgraph.gemspec ADDED
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'dgraph/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'dgraph'
9
+ spec.version = Dgraph::VERSION
10
+ spec.authors = ['Jihan Adel']
11
+ spec.email = ['jihan2032@gmail.com']
12
+
13
+ spec.summary = 'Dgraph driver for ruby'
14
+ spec.license = 'MIT'
15
+
16
+ # Specify which files should be added to the gem when it is released.
17
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
18
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
19
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ end
21
+ spec.bindir = 'exe'
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ['lib']
24
+
25
+ spec.add_development_dependency 'bundler', '~> 1.16'
26
+ spec.add_development_dependency 'minitest', '~> 5.0'
27
+ spec.add_development_dependency 'rake', '~> 10.0'
28
+
29
+ spec.add_dependency 'grpc'
30
+ end
data/lib/api_pb.rb ADDED
@@ -0,0 +1,150 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: api.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ Google::Protobuf::DescriptorPool.generated_pool.build do
7
+ add_message "api.Request" do
8
+ optional :query, :string, 1
9
+ map :vars, :string, :string, 2
10
+ optional :start_ts, :uint64, 13
11
+ optional :lin_read, :message, 14, "api.LinRead"
12
+ optional :read_only, :bool, 15
13
+ end
14
+ add_message "api.Response" do
15
+ optional :json, :bytes, 1
16
+ repeated :schema, :message, 2, "api.SchemaNode"
17
+ optional :txn, :message, 3, "api.TxnContext"
18
+ optional :latency, :message, 12, "api.Latency"
19
+ end
20
+ add_message "api.Assigned" do
21
+ map :uids, :string, :string, 1
22
+ optional :context, :message, 2, "api.TxnContext"
23
+ optional :latency, :message, 12, "api.Latency"
24
+ end
25
+ add_message "api.Mutation" do
26
+ optional :set_json, :bytes, 1
27
+ optional :delete_json, :bytes, 2
28
+ optional :set_nquads, :bytes, 3
29
+ optional :del_nquads, :bytes, 4
30
+ repeated :set, :message, 10, "api.NQuad"
31
+ repeated :del, :message, 11, "api.NQuad"
32
+ optional :start_ts, :uint64, 13
33
+ optional :commit_now, :bool, 14
34
+ optional :ignore_index_conflict, :bool, 15
35
+ end
36
+ add_message "api.Operation" do
37
+ optional :schema, :string, 1
38
+ optional :drop_attr, :string, 2
39
+ optional :drop_all, :bool, 3
40
+ end
41
+ add_message "api.Payload" do
42
+ optional :Data, :bytes, 1
43
+ end
44
+ add_message "api.TxnContext" do
45
+ optional :start_ts, :uint64, 1
46
+ optional :commit_ts, :uint64, 2
47
+ optional :aborted, :bool, 3
48
+ repeated :keys, :string, 4
49
+ repeated :preds, :string, 5
50
+ optional :lin_read, :message, 13, "api.LinRead"
51
+ end
52
+ add_message "api.Check" do
53
+ end
54
+ add_message "api.Version" do
55
+ optional :tag, :string, 1
56
+ end
57
+ add_message "api.LinRead" do
58
+ map :ids, :uint32, :uint64, 1
59
+ optional :sequencing, :enum, 2, "api.LinRead.Sequencing"
60
+ end
61
+ add_enum "api.LinRead.Sequencing" do
62
+ value :CLIENT_SIDE, 0
63
+ value :SERVER_SIDE, 1
64
+ end
65
+ add_message "api.Latency" do
66
+ optional :parsing_ns, :uint64, 1
67
+ optional :processing_ns, :uint64, 2
68
+ optional :encoding_ns, :uint64, 3
69
+ end
70
+ add_message "api.NQuad" do
71
+ optional :subject, :string, 1
72
+ optional :predicate, :string, 2
73
+ optional :object_id, :string, 3
74
+ optional :object_value, :message, 4, "api.Value"
75
+ optional :label, :string, 5
76
+ optional :lang, :string, 6
77
+ repeated :facets, :message, 7, "api.Facet"
78
+ end
79
+ add_message "api.Value" do
80
+ oneof :val do
81
+ optional :default_val, :string, 1
82
+ optional :bytes_val, :bytes, 2
83
+ optional :int_val, :int64, 3
84
+ optional :bool_val, :bool, 4
85
+ optional :str_val, :string, 5
86
+ optional :double_val, :double, 6
87
+ optional :geo_val, :bytes, 7
88
+ optional :date_val, :bytes, 8
89
+ optional :datetime_val, :bytes, 9
90
+ optional :password_val, :string, 10
91
+ optional :uid_val, :uint64, 11
92
+ end
93
+ end
94
+ add_message "api.Facet" do
95
+ optional :key, :string, 1
96
+ optional :value, :bytes, 2
97
+ optional :val_type, :enum, 3, "api.Facet.ValType"
98
+ repeated :tokens, :string, 4
99
+ optional :alias, :string, 5
100
+ end
101
+ add_enum "api.Facet.ValType" do
102
+ value :STRING, 0
103
+ value :INT, 1
104
+ value :FLOAT, 2
105
+ value :BOOL, 3
106
+ value :DATETIME, 4
107
+ end
108
+ add_message "api.SchemaNode" do
109
+ optional :predicate, :string, 1
110
+ optional :type, :string, 2
111
+ optional :index, :bool, 3
112
+ repeated :tokenizer, :string, 4
113
+ optional :reverse, :bool, 5
114
+ optional :count, :bool, 6
115
+ optional :list, :bool, 7
116
+ optional :upsert, :bool, 8
117
+ optional :lang, :bool, 9
118
+ end
119
+ add_message "api.LoginRequest" do
120
+ optional :userid, :string, 1
121
+ optional :password, :string, 2
122
+ optional :refresh_token, :string, 3
123
+ end
124
+ add_message "api.Jwt" do
125
+ optional :access_jwt, :string, 1
126
+ optional :refresh_jwt, :string, 2
127
+ end
128
+ end
129
+
130
+ module Api
131
+ Request = Google::Protobuf::DescriptorPool.generated_pool.lookup("api.Request").msgclass
132
+ Response = Google::Protobuf::DescriptorPool.generated_pool.lookup("api.Response").msgclass
133
+ Assigned = Google::Protobuf::DescriptorPool.generated_pool.lookup("api.Assigned").msgclass
134
+ Mutation = Google::Protobuf::DescriptorPool.generated_pool.lookup("api.Mutation").msgclass
135
+ Operation = Google::Protobuf::DescriptorPool.generated_pool.lookup("api.Operation").msgclass
136
+ Payload = Google::Protobuf::DescriptorPool.generated_pool.lookup("api.Payload").msgclass
137
+ TxnContext = Google::Protobuf::DescriptorPool.generated_pool.lookup("api.TxnContext").msgclass
138
+ Check = Google::Protobuf::DescriptorPool.generated_pool.lookup("api.Check").msgclass
139
+ Version = Google::Protobuf::DescriptorPool.generated_pool.lookup("api.Version").msgclass
140
+ LinRead = Google::Protobuf::DescriptorPool.generated_pool.lookup("api.LinRead").msgclass
141
+ LinRead::Sequencing = Google::Protobuf::DescriptorPool.generated_pool.lookup("api.LinRead.Sequencing").enummodule
142
+ Latency = Google::Protobuf::DescriptorPool.generated_pool.lookup("api.Latency").msgclass
143
+ NQuad = Google::Protobuf::DescriptorPool.generated_pool.lookup("api.NQuad").msgclass
144
+ Value = Google::Protobuf::DescriptorPool.generated_pool.lookup("api.Value").msgclass
145
+ Facet = Google::Protobuf::DescriptorPool.generated_pool.lookup("api.Facet").msgclass
146
+ Facet::ValType = Google::Protobuf::DescriptorPool.generated_pool.lookup("api.Facet.ValType").enummodule
147
+ SchemaNode = Google::Protobuf::DescriptorPool.generated_pool.lookup("api.SchemaNode").msgclass
148
+ LoginRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("api.LoginRequest").msgclass
149
+ Jwt = Google::Protobuf::DescriptorPool.generated_pool.lookup("api.Jwt").msgclass
150
+ end
@@ -0,0 +1,49 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: api.proto for package 'api'
3
+ # Original file comments:
4
+ #
5
+ # Copyright (C) 2017 Dgraph Labs, Inc. and Contributors
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+ # Style guide for Protocol Buffer 3.
20
+ # Use CamelCase (with an initial capital) for message names – for example,
21
+ # SongServerRequest. Use underscore_separated_names for field names – for
22
+ # example, song_name.
23
+ #
24
+
25
+ require 'grpc'
26
+ require_relative 'api_pb'
27
+
28
+ module Api
29
+ module Dgraph
30
+ # Graph response.
31
+ class Service
32
+
33
+ include GRPC::GenericService
34
+
35
+ self.marshal_class_method = :encode
36
+ self.unmarshal_class_method = :decode
37
+ self.service_name = 'api.Dgraph'
38
+
39
+ rpc :Login, LoginRequest, Response
40
+ rpc :Query, Request, Response
41
+ rpc :Mutate, Mutation, Assigned
42
+ rpc :Alter, Operation, Payload
43
+ rpc :CommitOrAbort, TxnContext, TxnContext
44
+ rpc :CheckVersion, Check, Version
45
+ end
46
+
47
+ Stub = Service.rpc_stub_class
48
+ end
49
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dgraph
4
+ VERSION = '0.1.0'
5
+ end
data/lib/dgraph.rb ADDED
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'grpc'
4
+ require_relative 'dgraph/version'
5
+ require_relative 'api_services_pb'
6
+
7
+ # D-graph ruby driver
8
+ module Dgraph
9
+ def self.mutate(query_string)
10
+ stub.mutate(Api::Mutation.new(set_json: query_string, commit_now: true))
11
+ end
12
+
13
+ def self.query(query_string, vars = {})
14
+ stub.query(Api::Request.new(query: query_string, vars: vars))
15
+ end
16
+
17
+ def self.stub
18
+ @stub ||= Api::Dgraph::Stub.new('localhost:9080', :this_channel_is_insecure)
19
+ end
20
+ end
data/proto/api.proto ADDED
@@ -0,0 +1,189 @@
1
+ /*
2
+ * Copyright (C) 2017 Dgraph Labs, Inc. and Contributors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ // Style guide for Protocol Buffer 3.
18
+ // Use CamelCase (with an initial capital) for message names – for example,
19
+ // SongServerRequest. Use underscore_separated_names for field names – for
20
+ // example, song_name.
21
+
22
+ syntax = "proto3";
23
+
24
+ package api;
25
+
26
+ /* import "gogoproto/gogo.proto"; */
27
+
28
+ /* option (gogoproto.marshaler_all) = true; */
29
+ /* option (gogoproto.sizer_all) = true; */
30
+ /* option (gogoproto.unmarshaler_all) = true; */
31
+ /* option (gogoproto.goproto_getters_all) = true; */
32
+
33
+ option java_package = "io.dgraph";
34
+ option java_outer_classname = "DgraphProto";
35
+
36
+ // Graph response.
37
+ service Dgraph {
38
+ rpc Login (LoginRequest) returns (Response) {}
39
+ rpc Query (Request) returns (Response) {}
40
+ rpc Mutate (Mutation) returns (Assigned) {}
41
+ rpc Alter (Operation) returns (Payload) {}
42
+ rpc CommitOrAbort (TxnContext) returns (TxnContext) {}
43
+ rpc CheckVersion(Check) returns (Version) {}
44
+ }
45
+
46
+ message Request {
47
+ string query = 1;
48
+ map<string, string> vars = 2; // Support for GraphQL like variables.
49
+
50
+ uint64 start_ts = 13;
51
+ LinRead lin_read = 14;
52
+ bool read_only = 15;
53
+ }
54
+
55
+ message Response {
56
+ bytes json = 1;
57
+ repeated SchemaNode schema = 2 [deprecated=true];
58
+ TxnContext txn = 3;
59
+ Latency latency = 12;
60
+ }
61
+
62
+ message Assigned {
63
+ map<string, string> uids = 1;
64
+ TxnContext context = 2;
65
+ Latency latency = 12;
66
+ }
67
+
68
+ message Mutation {
69
+ bytes set_json = 1;
70
+ bytes delete_json = 2;
71
+ bytes set_nquads = 3;
72
+ bytes del_nquads = 4;
73
+
74
+ repeated NQuad set = 10;
75
+ repeated NQuad del = 11;
76
+ uint64 start_ts = 13;
77
+ bool commit_now = 14;
78
+ bool ignore_index_conflict = 15; // this field is not parsed and used by the server anymore.
79
+ }
80
+
81
+
82
+ message Operation {
83
+ string schema = 1;
84
+ string drop_attr = 2;
85
+ bool drop_all = 3;
86
+ }
87
+
88
+ // Worker services.
89
+ message Payload {
90
+ bytes Data = 1;
91
+ }
92
+
93
+ message TxnContext {
94
+ uint64 start_ts = 1;
95
+ uint64 commit_ts = 2;
96
+ bool aborted = 3;
97
+ repeated string keys = 4; // List of keys to be used for conflict detection.
98
+ repeated string preds = 5; // List of predicates involved in this transaction.
99
+ LinRead lin_read = 13;
100
+ }
101
+
102
+ message Check {}
103
+
104
+ message Version {
105
+ string tag = 1;
106
+ }
107
+
108
+ message LinRead {
109
+ enum Sequencing {
110
+ CLIENT_SIDE = 0;
111
+ SERVER_SIDE = 1;
112
+ }
113
+
114
+ map<uint32, uint64> ids = 1;
115
+ Sequencing sequencing = 2;
116
+ }
117
+
118
+ message Latency {
119
+ uint64 parsing_ns = 1;
120
+ uint64 processing_ns = 2;
121
+ uint64 encoding_ns = 3;
122
+ }
123
+
124
+ message NQuad {
125
+ string subject = 1;
126
+ string predicate = 2;
127
+ string object_id = 3;
128
+ Value object_value = 4;
129
+ string label = 5;
130
+ string lang = 6;
131
+ repeated Facet facets = 7;
132
+ }
133
+
134
+ message Value {
135
+ oneof val {
136
+ string default_val = 1;
137
+ bytes bytes_val = 2;
138
+ int64 int_val = 3;
139
+ bool bool_val = 4;
140
+ string str_val = 5;
141
+ double double_val = 6;
142
+ bytes geo_val = 7; // Geo data in WKB format
143
+ bytes date_val = 8;
144
+ bytes datetime_val = 9;
145
+ string password_val = 10;
146
+ uint64 uid_val=11;
147
+ }
148
+ }
149
+
150
+ message Facet {
151
+ enum ValType {
152
+ STRING = 0;
153
+ INT = 1;
154
+ FLOAT = 2;
155
+ BOOL = 3;
156
+ DATETIME = 4;
157
+ }
158
+
159
+ string key = 1;
160
+ bytes value = 2;
161
+ ValType val_type = 3;
162
+ repeated string tokens = 4; // tokens of value.
163
+ string alias = 5; // not stored, only used for query.
164
+ }
165
+
166
+ message SchemaNode {
167
+ string predicate = 1;
168
+ string type = 2;
169
+ bool index = 3;
170
+ repeated string tokenizer = 4;
171
+ bool reverse = 5;
172
+ bool count = 6;
173
+ bool list = 7;
174
+ bool upsert = 8;
175
+ bool lang = 9;
176
+ }
177
+
178
+ message LoginRequest {
179
+ string userid = 1;
180
+ string password = 2;
181
+ string refresh_token = 3;
182
+ }
183
+
184
+ message Jwt {
185
+ string access_jwt = 1;
186
+ string refresh_jwt = 2;
187
+ }
188
+
189
+ // vim: noexpandtab sw=2 ts=2
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dgraph
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jihan Adel
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-03-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: grpc
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description:
70
+ email:
71
+ - jihan2032@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rubocop.yml"
78
+ - ".ruby-version"
79
+ - ".travis.yml"
80
+ - CODE_OF_CONDUCT.md
81
+ - Gemfile
82
+ - Gemfile.lock
83
+ - LICENSE.txt
84
+ - README.md
85
+ - Rakefile
86
+ - bin/console
87
+ - bin/setup
88
+ - dgraph.gemspec
89
+ - lib/api_pb.rb
90
+ - lib/api_services_pb.rb
91
+ - lib/dgraph.rb
92
+ - lib/dgraph/version.rb
93
+ - proto/api.proto
94
+ homepage:
95
+ licenses:
96
+ - MIT
97
+ metadata: {}
98
+ post_install_message:
99
+ rdoc_options: []
100
+ require_paths:
101
+ - lib
102
+ required_ruby_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ requirements: []
113
+ rubygems_version: 3.0.1
114
+ signing_key:
115
+ specification_version: 4
116
+ summary: Dgraph driver for ruby
117
+ test_files: []