cipherstash-pg 1.0.0.beta.1-x86_64-linux → 1.0.0.beta.4-x86_64-linux

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/.appveyor.yml +42 -0
  3. data/.gems +6 -0
  4. data/.gemtest +0 -0
  5. data/.github/workflows/binary-gems.yml +117 -0
  6. data/.github/workflows/source-gem.yml +137 -0
  7. data/.gitignore +19 -0
  8. data/.hgsigs +34 -0
  9. data/.hgtags +41 -0
  10. data/.irbrc +23 -0
  11. data/.pryrc +23 -0
  12. data/.tm_properties +21 -0
  13. data/.travis.yml +49 -0
  14. data/Gemfile +3 -3
  15. data/Gemfile.lock +45 -0
  16. data/{History.rdoc → History.md} +168 -153
  17. data/README.ja.md +266 -0
  18. data/README.md +272 -0
  19. data/Rakefile +65 -104
  20. data/Rakefile.cross +298 -0
  21. data/certs/larskanis-2023.pem +24 -0
  22. data/cipherstash-pg.gemspec +0 -0
  23. data/lib/2.7/pg_ext.so +0 -0
  24. data/lib/3.0/pg_ext.so +0 -0
  25. data/lib/3.1/pg_ext.so +0 -0
  26. data/lib/3.2/pg_ext.so +0 -0
  27. data/lib/cipherstash-pg/basic_type_map_based_on_result.rb +11 -0
  28. data/lib/cipherstash-pg/basic_type_map_for_queries.rb +113 -0
  29. data/lib/cipherstash-pg/basic_type_map_for_results.rb +30 -0
  30. data/lib/cipherstash-pg/basic_type_registry.rb +206 -0
  31. data/lib/cipherstash-pg/binary_decoder.rb +21 -0
  32. data/lib/cipherstash-pg/coder.rb +82 -0
  33. data/lib/cipherstash-pg/connection.rb +467 -0
  34. data/lib/cipherstash-pg/constants.rb +3 -0
  35. data/lib/cipherstash-pg/exceptions.rb +19 -0
  36. data/lib/cipherstash-pg/result.rb +22 -0
  37. data/lib/cipherstash-pg/text_decoder.rb +43 -0
  38. data/lib/cipherstash-pg/text_encoder.rb +67 -0
  39. data/lib/cipherstash-pg/tuple.rb +24 -0
  40. data/lib/cipherstash-pg/type_map_by_column.rb +11 -0
  41. data/lib/cipherstash-pg/version.rb +3 -0
  42. data/lib/cipherstash-pg.rb +56 -11
  43. data/lib/libpq.so.5 +0 -0
  44. data/misc/openssl-pg-segfault.rb +15 -25
  45. data/misc/postgres/Rakefile +13 -20
  46. data/misc/postgres/lib/postgres.rb +10 -14
  47. data/misc/ruby-pg/Rakefile +13 -20
  48. data/misc/ruby-pg/lib/ruby/pg.rb +10 -14
  49. data/rakelib/task_extension.rb +17 -31
  50. data/sample/array_insert.rb +7 -20
  51. data/sample/async_api.rb +54 -96
  52. data/sample/async_copyto.rb +20 -35
  53. data/sample/async_mixed.rb +22 -50
  54. data/sample/check_conn.rb +8 -20
  55. data/sample/copydata.rb +18 -68
  56. data/sample/copyfrom.rb +26 -78
  57. data/sample/copyto.rb +10 -16
  58. data/sample/cursor.rb +9 -19
  59. data/sample/disk_usage_report.rb +89 -174
  60. data/sample/issue-119.rb +45 -93
  61. data/sample/losample.rb +48 -66
  62. data/sample/minimal-testcase.rb +6 -17
  63. data/sample/notify_wait.rb +21 -67
  64. data/sample/pg_statistics.rb +100 -281
  65. data/sample/replication_monitor.rb +119 -218
  66. data/sample/test_binary_values.rb +14 -30
  67. data/sample/wal_shipper.rb +199 -431
  68. data/sample/warehouse_partitions.rb +157 -307
  69. data/translation/.po4a-version +7 -0
  70. data/translation/po/all.pot +875 -0
  71. data/translation/po/ja.po +868 -0
  72. data/translation/po4a.cfg +9 -0
  73. metadata +50 -28
  74. data/README.ja.rdoc +0 -13
  75. data/README.rdoc +0 -233
  76. data/lib/pg/basic_type_map_based_on_result.rb +0 -47
  77. data/lib/pg/basic_type_map_for_queries.rb +0 -193
  78. data/lib/pg/basic_type_map_for_results.rb +0 -81
  79. data/lib/pg/basic_type_registry.rb +0 -301
  80. data/lib/pg/binary_decoder.rb +0 -23
  81. data/lib/pg/coder.rb +0 -104
  82. data/lib/pg/connection.rb +0 -878
  83. data/lib/pg/constants.rb +0 -12
  84. data/lib/pg/exceptions.rb +0 -18
  85. data/lib/pg/result.rb +0 -43
  86. data/lib/pg/text_decoder.rb +0 -46
  87. data/lib/pg/text_encoder.rb +0 -59
  88. data/lib/pg/tuple.rb +0 -30
  89. data/lib/pg/type_map_by_column.rb +0 -16
  90. data/lib/pg/version.rb +0 -4
  91. data/lib/pg.rb +0 -55
data/lib/pg/constants.rb DELETED
@@ -1,12 +0,0 @@
1
- # -*- ruby -*-
2
- # frozen_string_literal: true
3
-
4
- require 'pg' unless defined?( PG )
5
-
6
-
7
- module PG::Constants
8
-
9
- # Most of these are defined in the extension.
10
-
11
- end # module PG::Constants
12
-
data/lib/pg/exceptions.rb DELETED
@@ -1,18 +0,0 @@
1
- # -*- ruby -*-
2
- # frozen_string_literal: true
3
-
4
- require 'pg' unless defined?( PG )
5
-
6
-
7
- module PG
8
-
9
- class Error < StandardError
10
- def initialize(msg=nil, connection: nil, result: nil)
11
- @connection = connection
12
- @result = result
13
- super(msg)
14
- end
15
- end
16
-
17
- end # module PG
18
-
data/lib/pg/result.rb DELETED
@@ -1,43 +0,0 @@
1
- # -*- ruby -*-
2
- # frozen_string_literal: true
3
-
4
- require 'pg' unless defined?( PG )
5
-
6
-
7
- class PG::Result
8
-
9
- # Apply a type map for all value retrieving methods.
10
- #
11
- # +type_map+: a PG::TypeMap instance.
12
- #
13
- # This method is equal to #type_map= , but returns self, so that calls can be chained.
14
- #
15
- # See also PG::BasicTypeMapForResults
16
- def map_types!(type_map)
17
- self.type_map = type_map
18
- return self
19
- end
20
-
21
- # Set the data type for all field name returning methods.
22
- #
23
- # +type+: a Symbol defining the field name type.
24
- #
25
- # This method is equal to #field_name_type= , but returns self, so that calls can be chained.
26
- def field_names_as(type)
27
- self.field_name_type = type
28
- return self
29
- end
30
-
31
- ### Return a String representation of the object suitable for debugging.
32
- def inspect
33
- str = self.to_s
34
- str[-1,0] = if cleared?
35
- " cleared"
36
- else
37
- " status=#{res_status(result_status)} ntuples=#{ntuples} nfields=#{nfields} cmd_tuples=#{cmd_tuples}"
38
- end
39
- return str
40
- end
41
-
42
- end # class PG::Result
43
-
@@ -1,46 +0,0 @@
1
- # -*- ruby -*-
2
- # frozen_string_literal: true
3
-
4
- require 'date'
5
- require 'json'
6
-
7
- module PG
8
- module TextDecoder
9
- class Date < SimpleDecoder
10
- def decode(string, tuple=nil, field=nil)
11
- if string =~ /\A(\d{4})-(\d\d)-(\d\d)\z/
12
- ::Date.new $1.to_i, $2.to_i, $3.to_i
13
- else
14
- string
15
- end
16
- end
17
- end
18
-
19
- class JSON < SimpleDecoder
20
- def decode(string, tuple=nil, field=nil)
21
- ::JSON.parse(string, quirks_mode: true)
22
- end
23
- end
24
-
25
- # Convenience classes for timezone options
26
- class TimestampUtc < Timestamp
27
- def initialize(params={})
28
- super(params.merge(flags: PG::Coder::TIMESTAMP_DB_UTC | PG::Coder::TIMESTAMP_APP_UTC))
29
- end
30
- end
31
- class TimestampUtcToLocal < Timestamp
32
- def initialize(params={})
33
- super(params.merge(flags: PG::Coder::TIMESTAMP_DB_UTC | PG::Coder::TIMESTAMP_APP_LOCAL))
34
- end
35
- end
36
- class TimestampLocal < Timestamp
37
- def initialize(params={})
38
- super(params.merge(flags: PG::Coder::TIMESTAMP_DB_LOCAL | PG::Coder::TIMESTAMP_APP_LOCAL))
39
- end
40
- end
41
-
42
- # For backward compatibility:
43
- TimestampWithoutTimeZone = TimestampLocal
44
- TimestampWithTimeZone = Timestamp
45
- end
46
- end # module PG
@@ -1,59 +0,0 @@
1
- # -*- ruby -*-
2
- # frozen_string_literal: true
3
-
4
- require 'json'
5
- require 'ipaddr'
6
-
7
- module PG
8
- module TextEncoder
9
- class Date < SimpleEncoder
10
- def encode(value)
11
- value.respond_to?(:strftime) ? value.strftime("%Y-%m-%d") : value
12
- end
13
- end
14
-
15
- class TimestampWithoutTimeZone < SimpleEncoder
16
- def encode(value)
17
- value.respond_to?(:strftime) ? value.strftime("%Y-%m-%d %H:%M:%S.%N") : value
18
- end
19
- end
20
-
21
- class TimestampUtc < SimpleEncoder
22
- def encode(value)
23
- value.respond_to?(:utc) ? value.utc.strftime("%Y-%m-%d %H:%M:%S.%N") : value
24
- end
25
- end
26
-
27
- class TimestampWithTimeZone < SimpleEncoder
28
- def encode(value)
29
- value.respond_to?(:strftime) ? value.strftime("%Y-%m-%d %H:%M:%S.%N %:z") : value
30
- end
31
- end
32
-
33
- class JSON < SimpleEncoder
34
- def encode(value)
35
- ::JSON.generate(value, quirks_mode: true)
36
- end
37
- end
38
-
39
- class Inet < SimpleEncoder
40
- def encode(value)
41
- case value
42
- when IPAddr
43
- default_prefix = (value.family == Socket::AF_INET ? 32 : 128)
44
- s = value.to_s
45
- if value.respond_to?(:prefix)
46
- prefix = value.prefix
47
- else
48
- range = value.to_range
49
- prefix = default_prefix - Math.log(((range.end.to_i - range.begin.to_i) + 1), 2).to_i
50
- end
51
- s << "/" << prefix.to_s if prefix != default_prefix
52
- s
53
- else
54
- value
55
- end
56
- end
57
- end
58
- end
59
- end # module PG
data/lib/pg/tuple.rb DELETED
@@ -1,30 +0,0 @@
1
- # -*- ruby -*-
2
- # frozen_string_literal: true
3
-
4
- require 'pg' unless defined?( PG )
5
-
6
-
7
- class PG::Tuple
8
-
9
- ### Return a String representation of the object suitable for debugging.
10
- def inspect
11
- "#<#{self.class} #{self.map{|k,v| "#{k}: #{v.inspect}" }.join(", ") }>"
12
- end
13
-
14
- def has_key?(key)
15
- field_map.has_key?(key)
16
- end
17
- alias key? has_key?
18
-
19
- def keys
20
- field_names || field_map.keys.freeze
21
- end
22
-
23
- def each_key(&block)
24
- if fn=field_names
25
- fn.each(&block)
26
- else
27
- field_map.each_key(&block)
28
- end
29
- end
30
- end
@@ -1,16 +0,0 @@
1
- # -*- ruby -*-
2
- # frozen_string_literal: true
3
-
4
- require 'pg' unless defined?( PG )
5
-
6
- class PG::TypeMapByColumn
7
- # Returns the type oids of the assigned coders.
8
- def oids
9
- coders.map{|c| c.oid if c }
10
- end
11
-
12
- def inspect
13
- type_strings = coders.map{|c| c ? c.inspect_short : 'nil' }
14
- "#<#{self.class} #{type_strings.join(' ')}>"
15
- end
16
- end
data/lib/pg/version.rb DELETED
@@ -1,4 +0,0 @@
1
- module PG
2
- # Library version
3
- VERSION = '1.4.5'
4
- end
data/lib/pg.rb DELETED
@@ -1,55 +0,0 @@
1
-
2
- # -*- ruby -*-
3
- # frozen_string_literal: true
4
-
5
- # The top-level PG namespace.
6
- module PG
7
-
8
- # cipherstash-pg *always* ships a "fat" gem with precompiled libs for each popular major.minor version
9
- # of Ruby that is still in use.
10
- major_minor = RUBY_VERSION[ /^(\d+\.\d+)/ ] or
11
- raise "Oops, can't extract the major/minor version from #{RUBY_VERSION.dump}"
12
- begin
13
- require "#{major_minor}/pg_ext"
14
- rescue => e
15
- STDERR.puts "Failed to load pg_ext for #{RUBY_VERSION.dump}"
16
- exit 1
17
- end
18
-
19
- class NotAllCopyDataRetrieved < PG::Error
20
- end
21
- class NotInBlockingMode < PG::Error
22
- end
23
-
24
- # Get the PG library version.
25
- #
26
- # +include_buildnum+ is no longer used and any value passed will be ignored.
27
- def self.version_string( include_buildnum=nil )
28
- "%s %s" % [ self.name, VERSION ]
29
- end
30
-
31
-
32
- ### Convenience alias for PG::Connection.new.
33
- def self.connect( *args, &block )
34
- Connection.new( *args, &block )
35
- end
36
-
37
-
38
- require 'pg/exceptions'
39
- require 'pg/constants'
40
- require 'pg/coder'
41
- require 'pg/binary_decoder'
42
- require 'pg/text_encoder'
43
- require 'pg/text_decoder'
44
- require 'pg/basic_type_registry'
45
- require 'pg/basic_type_map_based_on_result'
46
- require 'pg/basic_type_map_for_queries'
47
- require 'pg/basic_type_map_for_results'
48
- require 'pg/type_map_by_column'
49
- require 'pg/connection'
50
- require 'pg/result'
51
- require 'pg/tuple'
52
- require 'pg/version'
53
-
54
- end # module PG
55
-