pachyderm 1.7.3.9 → 1.7.3.12
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 +4 -4
- data/lib/pachyderm.rb +45 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60196b65da651bdd224c56b02a72d3809a3e3253
|
4
|
+
data.tar.gz: 2790c2033f91f439c06916ee79e5c8632eb71fd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8e2af31c373e3c88322ff4fd2c41b581efef1bce389c17df84923cdbc6c2764f61f6b46660a6f42f2cecb84ee5e20961716994d576bc1f465462cd681bc0930
|
7
|
+
data.tar.gz: f4b0fb3c89738248eb0e2c098637a94a5e2e30820ff90abb944a2490fd0d8607c6dad4263a913398f5c61ec597d822abb1116d64615da1833d39d25f6a11c598
|
data/lib/pachyderm.rb
CHANGED
@@ -14,11 +14,54 @@ module Pachyderm
|
|
14
14
|
return true
|
15
15
|
end
|
16
16
|
|
17
|
-
|
17
|
+
end
|
18
|
+
|
19
|
+
class Client
|
20
|
+
def initialize(address, token=nil)
|
21
|
+
@clients = {}
|
22
|
+
clients = Pachyderm.constants
|
23
|
+
# Omit the enterprise client
|
24
|
+
# It has a collision w the 'auth.activate' call
|
25
|
+
# and really you only use enterprise to administrate, and
|
26
|
+
# make that activate call once
|
27
|
+
# And. If you really need to call it via the ruby client,
|
28
|
+
# you can do so explicitly a la `Pachyderm::Enterprise::API::Stub.new ...`
|
29
|
+
clients.delete(:Enterprise)
|
30
|
+
clients.each do |sub_client_name|
|
31
|
+
sub_client = Pachyderm.const_get sub_client_name
|
32
|
+
next unless sub_client.const_defined? :API
|
33
|
+
@clients[sub_client_name] = sub_client.const_get(:API).const_get(:Stub).new(address, :this_channel_is_insecure)
|
34
|
+
end
|
35
|
+
@token = token
|
36
|
+
end
|
37
|
+
|
38
|
+
# The one 'sugar' method we provide, since it needs to make a call
|
39
|
+
# to both Pfs + Pps
|
40
|
+
def delete_all
|
41
|
+
req = Google::Protobuf::Empty.new
|
42
|
+
@clients[:Pfs].delete_all(req)
|
43
|
+
@clients[:Pps].delete_all(req)
|
44
|
+
end
|
45
|
+
|
46
|
+
def method_missing(m, *args, &block)
|
47
|
+
result = nil
|
48
|
+
method_found = false
|
49
|
+
@clients.each do |name, client|
|
50
|
+
if client.respond_to? m
|
51
|
+
method_found = true
|
52
|
+
args << metadata unless @token.nil?
|
53
|
+
result = client.send(m, *args, &block)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
raise Exception.new("method #{m} not found") unless method_found
|
57
|
+
result
|
58
|
+
end
|
59
|
+
|
60
|
+
def metadata()
|
18
61
|
# The 'authn-token' is a keyname hardcoded at:
|
19
62
|
# https://github.com/pachyderm/pachyderm/blob/master/src/client/auth/auth.go#L14
|
20
63
|
# TODO - as part of the 'make sync' build task, pull in this value
|
21
|
-
{:metadata => {'authn-token' => token}}
|
64
|
+
{:metadata => {'authn-token' => @token}}
|
22
65
|
end
|
23
66
|
end
|
24
67
|
end
|