crawlab_ruby_sdk 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/Gemfile +6 -0
- data/README.md +49 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/crawlab_ruby_sdk.gemspec +28 -0
- data/lib/client/task_service_client.rb +15 -0
- data/lib/client/task_service_subscribe_client.rb +52 -0
- data/lib/crawlab_ruby_sdk/version.rb +3 -0
- data/lib/crawlab_ruby_sdk.rb +60 -0
- data/lib/entity/node_info_pb.rb +17 -0
- data/lib/entity/plugin_request_pb.rb +18 -0
- data/lib/entity/request_pb.rb +17 -0
- data/lib/entity/response_code_pb.rb +15 -0
- data/lib/entity/response_pb.rb +22 -0
- data/lib/entity/result_pb.rb +15 -0
- data/lib/entity/stream_message_code_pb.rb +28 -0
- data/lib/entity/stream_message_data_task_pb.rb +58 -0
- data/lib/entity/stream_message_pb.rb +24 -0
- data/lib/models/node_pb.rb +27 -0
- data/lib/models/task_pb.rb +26 -0
- metadata +68 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 53cc3b34e599f5a093bb5c53b8b2b8604667212b4cdde7b735a5d5eb281a9449
|
4
|
+
data.tar.gz: 1f99db5c5ad65dd23cb7de3c6d8132a651fe66e2e15f05091cbda36aa93c90dc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3661d366e9178bcf22c34424cc4dc481837d8b34c10a1d66f5d71a88d9119a4954bdb92b8b1f2f2d801dca581a6edb8f103ee9a00c965b6e69040c714ba1bd4b
|
7
|
+
data.tar.gz: 18959fafddab87d747f2a5af38a6ac52b94546132e8f5d150811d6170292786c4331da44fdd88f47e7a0a858a5e93c2316db1e417df67adcfc297c8052d2762d
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# CrawlabRubySdk
|
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/crawlab_ruby_sdk`. 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 'crawlab_ruby_sdk'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle install
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install crawlab_ruby_sdk
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
CrawlabRubySdk.save_item(item={})
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. 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]/crawlab_ruby_sdk.
|
36
|
+
|
37
|
+
**bundle gem crawlab_ruby_sdk.gemspec**
|
38
|
+
**添加代码**
|
39
|
+
**gem build**
|
40
|
+
**gem install --local crawlab_ruby_sdk-0.1.0.gem**
|
41
|
+
|
42
|
+
curl -u ***** https://rubygems.org/api/v1/api_key.yaml # ***** 为你的用户名
|
43
|
+
|
44
|
+
$ rake -T
|
45
|
+
rake build # Build blomming_api-0.3.7.gem into the pkg directory
|
46
|
+
rake install # Build and install blomming_api-0.3.7.gem into system gems
|
47
|
+
rake release # Create tag v0.3.7 and build and push blomming_api-0.3.7.gem to Rubygems
|
48
|
+
|
49
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "crawlab_ruby_sdk"
|
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,28 @@
|
|
1
|
+
require_relative 'lib/crawlab_ruby_sdk/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "crawlab_ruby_sdk"
|
5
|
+
spec.version = CrawlabRubySdk::VERSION
|
6
|
+
spec.authors = ["min"]
|
7
|
+
spec.email = ["lijinmin3903@126.com"]
|
8
|
+
|
9
|
+
spec.summary = %q{This guy is very lazy.}
|
10
|
+
spec.description = %q{This guy is very lazy.}
|
11
|
+
spec.homepage = "https://github.com/rich-bro/crawlab_ruby_sdk"
|
12
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
13
|
+
|
14
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
15
|
+
|
16
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
17
|
+
spec.metadata["source_code_uri"] = "https://github.com/rich-bro/crawlab_ruby_sdk"
|
18
|
+
spec.metadata["changelog_uri"] = "https://github.com/rich-bro/crawlab_ruby_sdk"
|
19
|
+
|
20
|
+
# Specify which files should be added to the gem when it is released.
|
21
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
22
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
23
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
24
|
+
end
|
25
|
+
spec.bindir = "exe"
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class TaskServiceClient
|
2
|
+
attr_accessor :address
|
3
|
+
attr_accessor :auth
|
4
|
+
|
5
|
+
def initialize(address,auth)
|
6
|
+
@address = address
|
7
|
+
@auth = auth
|
8
|
+
end
|
9
|
+
|
10
|
+
# 返回 TaskServiceSubscribeClient
|
11
|
+
def subscribe
|
12
|
+
stub = TaskServiceSubscribeClient.new(@address,@auth)
|
13
|
+
return stub
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
class TaskServiceSubscribeClient
|
2
|
+
attr_accessor :stub
|
3
|
+
attr_accessor :metadata
|
4
|
+
|
5
|
+
def initialize(address,auth)
|
6
|
+
@stub = GRPC::ClientStub.new(address,:this_channel_is_insecure)
|
7
|
+
@metadata = {"authorization": auth}
|
8
|
+
|
9
|
+
end
|
10
|
+
|
11
|
+
def Send(streamMessage)
|
12
|
+
@stub.client_streamer("/grpc.TaskService/Subscribe", streamMessage, method(:marshal), method(:unmarshal),metadata: @metadata)
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
def marshal(obj)
|
17
|
+
# a = {
|
18
|
+
# code: obj.code,
|
19
|
+
# node_key: obj.node_key,
|
20
|
+
# key: obj.key,
|
21
|
+
# from: obj.from,
|
22
|
+
# to: obj.to,
|
23
|
+
# data: obj.data,
|
24
|
+
# error: obj.error,
|
25
|
+
# }
|
26
|
+
|
27
|
+
# return a.to_json
|
28
|
+
return Grpc::StreamMessage.encode(obj)
|
29
|
+
end
|
30
|
+
|
31
|
+
def unmarshal(str)
|
32
|
+
# a = JSON.parse(str)
|
33
|
+
|
34
|
+
# obj = StreamMessage.new(a)
|
35
|
+
# return obj
|
36
|
+
|
37
|
+
return Grpc::StreamMessage.decode(obj)
|
38
|
+
end
|
39
|
+
|
40
|
+
def each
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_send(streamMessage)
|
45
|
+
test_a(method(:marshal),streamMessage)
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_a(bbb,streamMessage)
|
49
|
+
a = bbb.call(streamMessage)
|
50
|
+
puts a
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require "crawlab_ruby_sdk/version"
|
2
|
+
require "grpc"
|
3
|
+
require "json"
|
4
|
+
def traverse_dir(file_path)
|
5
|
+
if File.directory? file_path
|
6
|
+
Dir.foreach(file_path){|file| traverse_dir(file_path+"/"+file) if file!="." and file!=".." }
|
7
|
+
else
|
8
|
+
load file_path if file_path.to_s.match(/\.rb$/)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
PWD = File.expand_path("..", __FILE__)
|
13
|
+
|
14
|
+
# puts PWD
|
15
|
+
|
16
|
+
traverse_dir(PWD+'/entity/stream_message_code_pb.rb')
|
17
|
+
traverse_dir(PWD+'/entity/result_pb.rb')
|
18
|
+
traverse_dir(PWD+'/entity/stream_message_pb.rb')
|
19
|
+
traverse_dir(PWD+'/entity/stream_message_data_task_pb.rb')
|
20
|
+
traverse_dir(PWD+'/client')
|
21
|
+
|
22
|
+
module CrawlabRubySdk
|
23
|
+
class Error < StandardError; end
|
24
|
+
# Your code goes here...
|
25
|
+
|
26
|
+
|
27
|
+
def self.save_item(item={})
|
28
|
+
address = ENV["CRAWLAB_GRPC_ADDRESS"]
|
29
|
+
if address==nil || address == ""
|
30
|
+
address = "localhost:9666"
|
31
|
+
end
|
32
|
+
|
33
|
+
auth = ENV["CRAWLAB_GRPC_AUTH_KEY"]
|
34
|
+
if auth==nil || auth == ""
|
35
|
+
auth = "Crawlab2021!"
|
36
|
+
end
|
37
|
+
|
38
|
+
client = TaskServiceClient.new(address,auth)
|
39
|
+
|
40
|
+
sub_client = client.subscribe
|
41
|
+
|
42
|
+
task_id = ENV["CRAWLAB_TASK_ID"]
|
43
|
+
if task_id == nil || task_id == ""
|
44
|
+
task_id = "6486e256fa1cb07a47c09adf"
|
45
|
+
end
|
46
|
+
item = {"hello": "world","_tid":task_id}
|
47
|
+
item = Grpc::Result.new({"_tid":task_id,"name":"lala","age":"12"})
|
48
|
+
|
49
|
+
data = Grpc::StreamMessageDataTask.new()
|
50
|
+
# puts item
|
51
|
+
|
52
|
+
data.task_id = task_id
|
53
|
+
data.data.push(item)
|
54
|
+
|
55
|
+
puts data
|
56
|
+
msg = Grpc::StreamMessage.new(code:3,data:data.to_json)
|
57
|
+
puts msg
|
58
|
+
sub_client.Send([msg])
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: entity/node_info.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
7
|
+
add_file("entity/node_info.proto", :syntax => :proto3) do
|
8
|
+
add_message "grpc.NodeInfo" do
|
9
|
+
optional :key, :string, 1
|
10
|
+
optional :is_master, :bool, 2
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
module Grpc
|
16
|
+
NodeInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.NodeInfo").msgclass
|
17
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: entity/plugin_request.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
7
|
+
add_file("entity/plugin_request.proto", :syntax => :proto3) do
|
8
|
+
add_message "grpc.PluginRequest" do
|
9
|
+
optional :name, :string, 1
|
10
|
+
optional :node_key, :string, 2
|
11
|
+
optional :data, :bytes, 3
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
module Grpc
|
17
|
+
PluginRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.PluginRequest").msgclass
|
18
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: entity/request.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
7
|
+
add_file("entity/request.proto", :syntax => :proto3) do
|
8
|
+
add_message "grpc.Request" do
|
9
|
+
optional :node_key, :string, 1
|
10
|
+
optional :data, :bytes, 2
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
module Grpc
|
16
|
+
Request = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.Request").msgclass
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: entity/response_code.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
7
|
+
add_file("entity/response_code.proto", :syntax => :proto3) do
|
8
|
+
add_enum "ResponseCode" do
|
9
|
+
value :OK, 0
|
10
|
+
value :ERROR, 1
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
ResponseCode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("ResponseCode").enummodule
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: entity/response.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'entity/response_code_pb'
|
7
|
+
|
8
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
9
|
+
add_file("entity/response.proto", :syntax => :proto3) do
|
10
|
+
add_message "grpc.Response" do
|
11
|
+
optional :code, :enum, 1, "ResponseCode"
|
12
|
+
optional :message, :string, 2
|
13
|
+
optional :data, :bytes, 3
|
14
|
+
optional :error, :string, 4
|
15
|
+
optional :total, :int64, 5
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
module Grpc
|
21
|
+
Response = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.Response").msgclass
|
22
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'google/protobuf'
|
2
|
+
|
3
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
4
|
+
add_file("entity/result.proto", :syntax => :proto3) do
|
5
|
+
add_message "grpc.Result" do
|
6
|
+
optional :_tid, :string, 1
|
7
|
+
optional :name, :string, 2
|
8
|
+
optional :age, :string, 3
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
module Grpc
|
14
|
+
Result = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.Result").msgclass
|
15
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: entity/stream_message_code.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
7
|
+
add_file("proto/entity/stream_message_code.proto", :syntax => :proto3) do
|
8
|
+
add_enum "grpc.StreamMessageCode" do
|
9
|
+
value :PING, 0
|
10
|
+
value :RUN_TASK, 1
|
11
|
+
value :CANCEL_TASK, 2
|
12
|
+
value :INSERT_DATA, 3
|
13
|
+
value :INSERT_LOGS, 4
|
14
|
+
value :SEND_EVENT, 5
|
15
|
+
value :INSTALL_PLUGIN, 6
|
16
|
+
value :UNINSTALL_PLUGIN, 7
|
17
|
+
value :START_PLUGIN, 8
|
18
|
+
value :STOP_PLUGIN, 9
|
19
|
+
value :CONNECT, 10
|
20
|
+
value :DISCONNECT, 11
|
21
|
+
value :SEND, 12
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
module Grpc
|
27
|
+
StreamMessageCode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.StreamMessageCode").enummodule
|
28
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# # Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# # source: entity/stream_message_data_task.proto
|
3
|
+
|
4
|
+
# require 'google/protobuf'
|
5
|
+
|
6
|
+
# Google::Protobuf::DescriptorPool.generated_pool.build do
|
7
|
+
# add_file(PWD + "/proto/entity/stream_message_data_task.proto", :syntax => :proto3) do
|
8
|
+
# add_message "grpc.StreamMessageDataTask" do
|
9
|
+
# optional :task_id, :string, 1
|
10
|
+
# optional :data, :string,:repeated, 2
|
11
|
+
# end
|
12
|
+
# end
|
13
|
+
# end
|
14
|
+
|
15
|
+
# module Grpc
|
16
|
+
# StreamMessageDataTask = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.StreamMessageDataTask").msgclass
|
17
|
+
# end
|
18
|
+
|
19
|
+
|
20
|
+
# frozen_string_literal: true
|
21
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
22
|
+
# source: entity/stream_message_data_task.proto
|
23
|
+
|
24
|
+
require 'google/protobuf'
|
25
|
+
|
26
|
+
# require 'entity/result_pb'
|
27
|
+
|
28
|
+
|
29
|
+
descriptor_data = "\n%entity/stream_message_data_task.proto\x12\x04grpc\x1a\x13\x65ntity/result.proto\"D\n\x15StreamMessageDataTask\x12\x0f\n\x07task_id\x18\x01 \x01(\t\x12\x1a\n\x04\x64\x61ta\x18\x02 \x03(\x0b\x32\x0c.grpc.ResultB\x08Z\x06.;grpcb\x06proto3"
|
30
|
+
|
31
|
+
pool = Google::Protobuf::DescriptorPool.generated_pool
|
32
|
+
|
33
|
+
begin
|
34
|
+
pool.add_serialized_file(descriptor_data)
|
35
|
+
rescue TypeError => e
|
36
|
+
# Compatibility code: will be removed in the next major version.
|
37
|
+
require 'google/protobuf/descriptor_pb'
|
38
|
+
parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
|
39
|
+
parsed.clear_dependency
|
40
|
+
serialized = parsed.class.encode(parsed)
|
41
|
+
file = pool.add_serialized_file(serialized)
|
42
|
+
warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
|
43
|
+
imports = [
|
44
|
+
["grpc.Result", "entity/result.proto"],
|
45
|
+
]
|
46
|
+
imports.each do |type_name, expected_filename|
|
47
|
+
import_file = pool.lookup(type_name).file_descriptor
|
48
|
+
if import_file.name != expected_filename
|
49
|
+
warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
warn "Each proto file must use a consistent fully-qualified name."
|
53
|
+
warn "This will become an error in the next major version."
|
54
|
+
end
|
55
|
+
|
56
|
+
module Grpc
|
57
|
+
StreamMessageDataTask = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.StreamMessageDataTask").msgclass
|
58
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: entity/stream_message.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
# require 'entity/stream_message_code_pb'
|
7
|
+
|
8
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
9
|
+
add_file("proto/entity/stream_message.proto", :syntax => :proto3) do
|
10
|
+
add_message "grpc.StreamMessage" do
|
11
|
+
optional :code, :enum, 1, "grpc.StreamMessageCode"
|
12
|
+
optional :node_key, :string, 2
|
13
|
+
optional :key, :string, 3
|
14
|
+
optional :from, :string, 4
|
15
|
+
optional :to, :string, 5
|
16
|
+
optional :data, :bytes, 6
|
17
|
+
optional :error, :string, 7
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
module Grpc
|
23
|
+
StreamMessage = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.StreamMessage").msgclass
|
24
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: models/node.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
7
|
+
add_file("proto/models/node.proto", :syntax => :proto3) do
|
8
|
+
add_message "grpc.Node" do
|
9
|
+
optional :_id, :string, 1
|
10
|
+
optional :name, :string, 2
|
11
|
+
optional :ip, :string, 3
|
12
|
+
optional :port, :string, 5
|
13
|
+
optional :mac, :string, 6
|
14
|
+
optional :hostname, :string, 7
|
15
|
+
optional :description, :string, 8
|
16
|
+
optional :key, :string, 9
|
17
|
+
optional :is_master, :bool, 11
|
18
|
+
optional :update_ts, :string, 12
|
19
|
+
optional :create_ts, :string, 13
|
20
|
+
optional :update_ts_unix, :int64, 14
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
module Grpc
|
26
|
+
Node = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.Node").msgclass
|
27
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: models/task.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
7
|
+
add_file("models/task.proto", :syntax => :proto3) do
|
8
|
+
add_message "grpc.Task" do
|
9
|
+
optional :_id, :string, 1
|
10
|
+
optional :spider_id, :string, 2
|
11
|
+
optional :status, :string, 5
|
12
|
+
optional :node_id, :string, 6
|
13
|
+
optional :cmd, :string, 8
|
14
|
+
optional :param, :string, 9
|
15
|
+
optional :error, :string, 10
|
16
|
+
optional :pid, :int32, 16
|
17
|
+
optional :run_type, :string, 17
|
18
|
+
optional :schedule_id, :string, 18
|
19
|
+
optional :type, :string, 19
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
module Grpc
|
25
|
+
Task = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.Task").msgclass
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: crawlab_ruby_sdk
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- min
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-06-14 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: This guy is very lazy.
|
14
|
+
email:
|
15
|
+
- lijinmin3903@126.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".gitignore"
|
21
|
+
- Gemfile
|
22
|
+
- README.md
|
23
|
+
- Rakefile
|
24
|
+
- bin/console
|
25
|
+
- bin/setup
|
26
|
+
- crawlab_ruby_sdk.gemspec
|
27
|
+
- lib/client/task_service_client.rb
|
28
|
+
- lib/client/task_service_subscribe_client.rb
|
29
|
+
- lib/crawlab_ruby_sdk.rb
|
30
|
+
- lib/crawlab_ruby_sdk/version.rb
|
31
|
+
- lib/entity/node_info_pb.rb
|
32
|
+
- lib/entity/plugin_request_pb.rb
|
33
|
+
- lib/entity/request_pb.rb
|
34
|
+
- lib/entity/response_code_pb.rb
|
35
|
+
- lib/entity/response_pb.rb
|
36
|
+
- lib/entity/result_pb.rb
|
37
|
+
- lib/entity/stream_message_code_pb.rb
|
38
|
+
- lib/entity/stream_message_data_task_pb.rb
|
39
|
+
- lib/entity/stream_message_pb.rb
|
40
|
+
- lib/models/node_pb.rb
|
41
|
+
- lib/models/task_pb.rb
|
42
|
+
homepage: https://github.com/rich-bro/crawlab_ruby_sdk
|
43
|
+
licenses: []
|
44
|
+
metadata:
|
45
|
+
allowed_push_host: https://rubygems.org
|
46
|
+
homepage_uri: https://github.com/rich-bro/crawlab_ruby_sdk
|
47
|
+
source_code_uri: https://github.com/rich-bro/crawlab_ruby_sdk
|
48
|
+
changelog_uri: https://github.com/rich-bro/crawlab_ruby_sdk
|
49
|
+
post_install_message:
|
50
|
+
rdoc_options: []
|
51
|
+
require_paths:
|
52
|
+
- lib
|
53
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: 2.3.0
|
58
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
requirements: []
|
64
|
+
rubygems_version: 3.1.4
|
65
|
+
signing_key:
|
66
|
+
specification_version: 4
|
67
|
+
summary: This guy is very lazy.
|
68
|
+
test_files: []
|