pachyderm 1.7.3.9 → 1.7.3.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pachyderm.rb +45 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 59864f13b017a9a8e62a429d2ce1f5941f6bb21b
4
- data.tar.gz: a6c2dd283f3ab9fc41f4b6433321662d04a1d9ad
3
+ metadata.gz: 60196b65da651bdd224c56b02a72d3809a3e3253
4
+ data.tar.gz: 2790c2033f91f439c06916ee79e5c8632eb71fd7
5
5
  SHA512:
6
- metadata.gz: d27eb66385907c2e295ff384d556f35613d0387fe5f8e232ec3515fa04663247920a392bd003d2ce7f2d449f2432a83ba02545cc4ac98e490ee49e103c17be3b
7
- data.tar.gz: 4d0cad7f25dc0764b7b40c0885e61cf9feeb3c67c8a1a8ae7b4cfaf81ab5ea2159b2108ebcdf925694b4a4212eb502c5f3c7128514c07db67dcdcbdb6a19f0f0
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
- def metadata(token)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pachyderm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.3.9
4
+ version: 1.7.3.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Doliner