rims 0.2.6 → 0.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f51adf08f317981cdec3bb1067edd7a6c4befcf2f3e3e9c3ab4ac97702dad80
4
- data.tar.gz: d0089e4150ad0768b0267c3c34980fad6a5251f0953997bd75a8c00e590120bb
3
+ metadata.gz: fe462a03485c3e28162aef29617c769fe660f1fcb5d431fe4fcd5034e967fb49
4
+ data.tar.gz: 10654bf0987325929b673e815b245d7821ab3b7fd76a90c73d2f534cef729eee
5
5
  SHA512:
6
- metadata.gz: 4be9394ccaa4e2081dcc4040f197f375444b04953706c050aad5b1e255121cfec2d49753f31160f0dc458dcac139296b37c5efe0685f749904e5a0d74c705b24
7
- data.tar.gz: a1a1a3f16b3069b2fd0e2ee9016349fbb2bb43401220ed9d00beec44914b4ef0206582c41a2bfb94c895d91ea6eb62ba76dcdd342338aa5becb8670777a3343a
6
+ metadata.gz: 22f60433f0d748c266e377da045d544910d5e13028649d381fafdc40e5fbac0a5fc62e67c7bd777a6b46ef84058a4e690a302dc8a8d9d422996ec1926e82deef
7
+ data.tar.gz: 7a2b9c3094f79e94dc85176d3710a1a1e95c96c53ad8d5c8bf36f51ce123928497a518bb7d3ee69dea400bd793fe29536d114e867b95d647e055348062f14893
data/.gitignore CHANGED
@@ -14,6 +14,9 @@
14
14
  /tmp/
15
15
  /vendor/
16
16
  /Gemfile.lock
17
+ /Gemfile_local*
17
18
  /README.html
18
19
  *~
20
+ .#*
21
+ \#*
19
22
  *.log
@@ -0,0 +1,97 @@
1
+ Change Log
2
+ ==========
3
+
4
+ <!--
5
+ subsections:
6
+ ### Added
7
+ ### Changed
8
+ ### Removed
9
+ ### Fixed
10
+ -->
11
+
12
+ 0.3.1
13
+ -----
14
+ Released on 2020-08-29.
15
+
16
+ ### Added
17
+ - Input size limits.
18
+ [#34](https://github.com/y10k/rims/issues/34)
19
+ - Configurable bulk_response_size parameter.
20
+ [#36](https://github.com/y10k/rims/issues/36)
21
+
22
+ ### Changed
23
+ - Ready to Ruby 2.7.
24
+ [#35](https://github.com/y10k/rims/issues/35)
25
+ - Semantic versioning.
26
+ [#37](https://github.com/y10k/rims/issues/37)
27
+
28
+ 0.2.9
29
+ -----
30
+ Released on 2019-12-12.
31
+
32
+ ### Added
33
+ - Add `umask(2)` configuration parameter. [#29](https://github.com/y10k/rims/issues/29)
34
+ - Add debug logging for conflicted subscriber error. This problem is
35
+ not solved because it does not reappear. [#28](https://github.com/y10k/rims/issues/28)
36
+
37
+ ### Changed
38
+ - Ready to Ruby 2.7. [#35](https://github.com/y10k/rims/issues/35)
39
+
40
+ ### Fixed
41
+ - Fix a bug of detached thread finishing a protocol decoder engine.
42
+ - Make bulk message size of inter-process communication not exceeding `DRb`'s `load_limit`.
43
+ [#30](https://github.com/y10k/rims/issues/30)
44
+ [#33](https://github.com/y10k/rims/issues/33)
45
+
46
+ 0.2.8
47
+ -----
48
+ Released on 2019-10-10.
49
+
50
+ 0.2.7
51
+ -----
52
+ Released on 2019-07-27.
53
+
54
+ 0.2.6
55
+ -----
56
+ Released on 2019-07-09.
57
+
58
+ 0.2.5
59
+ -----
60
+ Released on 2019-06-10.
61
+
62
+ 0.2.4
63
+ -----
64
+ Released on 2019-04-25.
65
+
66
+ 0.2.3
67
+ -----
68
+ Released on 2019-04-10.
69
+
70
+ 0.2.2
71
+ -----
72
+ Released on 2019-03-06.
73
+
74
+ 0.2.1
75
+ -----
76
+ Released on 2019-02-18.
77
+
78
+ 0.1.0
79
+ -----
80
+ Released on 2015-02-22.
81
+
82
+ 0.0.4
83
+ -----
84
+ Released on 2014-06-08.
85
+
86
+ 0.0.3
87
+ -----
88
+ Released on 2014-04-15.
89
+
90
+ 0.0.2
91
+ -----
92
+ Released on 2014-03-05.
93
+
94
+ 0.0.1
95
+ -----
96
+ Released on 2014-02-24.
97
+
data/ChangeLog CHANGED
@@ -1,3 +1,52 @@
1
+ 2019-12-12 TOKI Yoshinori <toki@freedom.ne.jp>
2
+
3
+ * ChangeLog: updates to this file have been stopped.
4
+ see CHANGELOG.md from now on.
5
+
6
+ 2019-10-10 TOKI Yoshinori <toki@freedom.ne.jp>
7
+
8
+ * RIMS version 0.2.8 is released.
9
+
10
+ 2019-08-12 TOKI Yoshinori <toki@freedom.ne.jp>
11
+
12
+ * lib/rims/cmd.rb, lib/rims/service.rb: DRb service load_limit
13
+ option.
14
+
15
+ 2019-07-27 TOKI Yoshinori <toki@freedom.ne.jp>
16
+
17
+ * RIMS version 0.2.7 is released.
18
+
19
+ 2019-07-25 TOKI Yoshinori <toki@freedom.ne.jp>
20
+
21
+ * lib/rims/cmd.rb, lib/rims/protocol/decoder.rb,
22
+ lib/rims/protocol/parser.rb, lib/rims/service.rb: message charset
23
+ encoding conversion options.
24
+
25
+ 2019-07-22 TOKI Yoshinori <toki@freedom.ne.jp>
26
+
27
+ * lib/rims/cmd.rb, lib/rims/protocol/decoder.rb,
28
+ lib/rims/protocol/parser.rb, lib/rims/service.rb: charset aliases
29
+ option.
30
+
31
+ 2019-07-20 TOKI Yoshinori <toki@freedom.ne.jp>
32
+
33
+ * lib/rims/protocol/decoder.rb, lib/rims/protocol/parser.rb:
34
+ case-insensitive matching of SEARCH command.
35
+
36
+ See RFC3501 / 6.4.4. SEARCH Command
37
+ <https://tools.ietf.org/html/rfc3501#section-6.4.4>
38
+
39
+ In all search keys that use strings, a message matches the key if
40
+ the string is a substring of the field. The matching is
41
+ case-insensitive.
42
+
43
+ * lib/rims/protocol/parser.rb: search for MIME encoded header
44
+ fields.
45
+
46
+ 2019-07-09 TOKI Yoshinori <toki@freedom.ne.jp>
47
+
48
+ * RIMS version 0.2.6 is released.
49
+
1
50
  2019-07-08 TOKI Yoshinori <toki@freedom.ne.jp>
2
51
 
3
52
  * lib/rims/cmd.rb: disable plug-in name list on plug-in command
data/Rakefile CHANGED
@@ -28,14 +28,18 @@ Rake::RDocTask.new do |rd|
28
28
  rd.rdoc_files.include('lib/**/*.rb')
29
29
  end
30
30
 
31
+ rule '.html' => '.md' do |t|
32
+ sh "pandoc --from=markdown --to=html5 --standalone --self-contained --css=$HOME/.pandoc/github.css --output=#{t.name} #{t.source}"
33
+ end
34
+
31
35
  desc 'Build README.html from markdown source'
32
36
  task :readme => %w[ README.html ]
33
-
34
- file 'README.html' => [ 'README.md' ] do
35
- sh "pandoc --from=markdown --to=html5 --standalone --self-contained --css=$HOME/.pandoc/github.css --output=README.html README.md"
36
- end
37
37
  CLOBBER.include 'README.html'
38
38
 
39
+ desc 'Build CHANGELOG.html from markdown source'
40
+ task :changelog => %w[ CHANGELOG.html ]
41
+ CLOBBER.include 'CHANGELOG.html'
42
+
39
43
  namespace :test_cert do
40
44
  tls_dir = Pathname('test/tls')
41
45
 
@@ -5,35 +5,37 @@ require "rims/version"
5
5
  autoload :OpenSSL, 'openssl'
6
6
 
7
7
  module RIMS
8
- autoload :Authentication, 'rims/auth'
9
- autoload :Checksum_KeyValueStore, 'rims/cksum_kvs'
10
- autoload :Cmd, 'rims/cmd'
11
- autoload :DB, 'rims/db'
12
- autoload :Error, 'rims/error'
13
- autoload :GDBM_KeyValueStore, 'rims/gdbm_kvs'
14
- autoload :GlobalDB, 'rims/db'
15
- autoload :Hash_KeyValueStore, 'rims/hash_kvs'
16
- autoload :IllegalLockError, 'rims/lock'
17
- autoload :KeyValueStore, 'rims/kvs'
18
- autoload :LockError, 'rims/lock'
19
- autoload :MailFolder, 'rims/mail_store'
20
- autoload :MailStore, 'rims/mail_store'
21
- autoload :MailboxDB, 'rims/db'
22
- autoload :MessageDB, 'rims/db'
23
- autoload :MessageSetSyntaxError, 'rims/protocol'
24
- autoload :Password, 'rims/passwd'
25
- autoload :Protocol, 'rims/protocol'
26
- autoload :ProtocolError, 'rims/protocol'
27
- autoload :RFC822, 'rims/rfc822'
28
- autoload :ReadLockError, 'rims/lock'
29
- autoload :ReadLockTimeoutError, 'rims/lock'
30
- autoload :ReadWriteLock, 'rims/lock'
31
- autoload :ServerResponseChannel, 'rims/channel'
32
- autoload :Service, 'rims/service'
33
- autoload :SyntaxError, 'rims/protocol'
34
- autoload :Test, 'rims/test'
35
- autoload :WriteLockError, 'rims/lock'
36
- autoload :WriteLockTimeoutError, 'rims/lock'
8
+ autoload :Authentication, 'rims/auth'
9
+ autoload :Checksum_KeyValueStore, 'rims/cksum_kvs'
10
+ autoload :Cmd, 'rims/cmd'
11
+ autoload :CommandSizeTooLargeError, 'rims/protocol'
12
+ autoload :DB, 'rims/db'
13
+ autoload :Error, 'rims/error'
14
+ autoload :GDBM_KeyValueStore, 'rims/gdbm_kvs'
15
+ autoload :Hash_KeyValueStore, 'rims/hash_kvs'
16
+ autoload :IllegalLockError, 'rims/lock'
17
+ autoload :KeyValueStore, 'rims/kvs'
18
+ autoload :LineTooLongError, 'rims/protocol'
19
+ autoload :LiteralSizeTooLargeError, 'rims/protocol'
20
+ autoload :LockError, 'rims/lock'
21
+ autoload :MailFolder, 'rims/mail_store'
22
+ autoload :MailStore, 'rims/mail_store'
23
+ autoload :MessageSetSyntaxError, 'rims/protocol'
24
+ autoload :Password, 'rims/passwd'
25
+ autoload :Protocol, 'rims/protocol'
26
+ autoload :ProtocolError, 'rims/protocol'
27
+ autoload :RFC822, 'rims/rfc822'
28
+ autoload :ReadLockError, 'rims/lock'
29
+ autoload :ReadLockTimeoutError, 'rims/lock'
30
+ autoload :ReadSizeError, 'rims/protocol'
31
+ autoload :ReadWriteLock, 'rims/lock'
32
+ autoload :RecoverableReadSizeError, 'rims/protocol'
33
+ autoload :ServerResponseChannel, 'rims/channel'
34
+ autoload :Service, 'rims/service'
35
+ autoload :SyntaxError, 'rims/protocol'
36
+ autoload :Test, 'rims/test'
37
+ autoload :WriteLockError, 'rims/lock'
38
+ autoload :WriteLockTimeoutError, 'rims/lock'
37
39
  end
38
40
 
39
41
  # Local Variables:
@@ -1,6 +1,20 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
+ require 'forwardable'
4
+
3
5
  module RIMS
6
+ class ServerResponseChannelError < Error
7
+ end
8
+
9
+ class ServerResponseChannelAttachError < ServerResponseChannelError
10
+ end
11
+
12
+ class ServerResponseChannelDetachError < ServerResponseChannelError
13
+ end
14
+
15
+ class ServerResponseChannelPublishError < ServerResponseChannelError
16
+ end
17
+
4
18
  class ServerResponseChannel
5
19
  def initialize
6
20
  @mutex = Thread::Mutex.new
@@ -9,14 +23,16 @@ module RIMS
9
23
 
10
24
  def make_pub_sub_pair(mbox_id)
11
25
  pub = ServerResponsePublisher.new(self, mbox_id)
12
- sub = ServerResponseSubscriber.new(self, mbox_id, pub.pub_sub_pair_key)
26
+ sub = ServerResponseSubscriber.new(self, pub)
13
27
  return pub, attach(sub)
14
28
  end
15
29
 
16
30
  def attach(sub)
17
31
  @mutex.synchronize{
18
32
  @channel[sub.mbox_id] ||= {}
19
- (@channel[sub.mbox_id].key? sub.pub_sub_pair_key) and raise ArgumentError, 'conflicted subscriber.'
33
+ if (@channel[sub.mbox_id].key? sub.pub_sub_pair_key) then
34
+ raise ServerResponseChannelAttachError.new('conflicted subscriber.', channel: self, subscriber: sub)
35
+ end
20
36
  @channel[sub.mbox_id][sub.pub_sub_pair_key] = sub
21
37
  }
22
38
 
@@ -30,8 +46,13 @@ module RIMS
30
46
  # - ServerResponseSubscriber#detach
31
47
  def detach(sub)
32
48
  @mutex.synchronize{
33
- ((@channel.key? sub.mbox_id) && (@channel[sub.mbox_id].key? sub.pub_sub_pair_key)) or raise ArgumentError, 'unregistered pub-sub pair.'
34
- (@channel[sub.mbox_id][sub.pub_sub_pair_key] == sub) or raise 'internal error: mismatched subscriber.'
49
+ unless ((@channel.key? sub.mbox_id) && (@channel[sub.mbox_id].key? sub.pub_sub_pair_key)) then
50
+ raise ServerResponseChannelDetachError.new('unregistered pub-sub pair.', channel: self, subscriber: sub)
51
+ end
52
+
53
+ unless (@channel[sub.mbox_id][sub.pub_sub_pair_key] == sub) then
54
+ raise ServerResponseChannelDetachError.new('internal error: mismatched subscriber.', channel: self, subscribe: sub)
55
+ end
35
56
 
36
57
  @channel[sub.mbox_id].delete(sub.pub_sub_pair_key)
37
58
  if (@channel[sub.mbox_id].empty?) then
@@ -74,7 +95,12 @@ module RIMS
74
95
  end
75
96
 
76
97
  def publish(response_message)
77
- @channel or raise 'detached publisher.'
98
+ unless (@channel) then
99
+ raise ServerResponseChannelPublishError.new('detached publisher.',
100
+ publisher: self,
101
+ pub_sub_pair_key: pub_sub_pair_key,
102
+ message: response_message)
103
+ end
78
104
  @channel.publish(@mbox_id, pub_sub_pair_key, response_message)
79
105
  nil
80
106
  end
@@ -89,15 +115,14 @@ module RIMS
89
115
  # do not call this method directly, call the following method
90
116
  # instead.
91
117
  # - ServerResponseChannel#make_pub_sub_pair
92
- def initialize(channel, mbox_id, pub_sub_pair_key)
118
+ def initialize(channel, pub)
93
119
  @channel = channel
94
- @mbox_id = mbox_id
95
- @pub_sub_pair_key = pub_sub_pair_key
120
+ @pub = pub
96
121
  @queue = Thread::Queue.new
97
122
  end
98
123
 
99
- attr_reader :mbox_id
100
- attr_reader :pub_sub_pair_key
124
+ extend Forwardable
125
+ def_delegators :@pub, :mbox_id, :pub_sub_pair_key
101
126
 
102
127
  # do not call this method directly, call the following method
103
128
  # instead.
@@ -325,6 +325,16 @@ module RIMS
325
325
  })
326
326
  }
327
327
  end
328
+ options.on('--daemon-umask=UMASK',
329
+ Integer,
330
+ "Umask(2). effective only with daemon command. default is `#{'%04o' % Service::DEFAULT_CONFIG.daemon_umask}'."
331
+ ) do |umask|
332
+ build.chain{|c|
333
+ c.load(daemon: {
334
+ umask: umask
335
+ })
336
+ }
337
+ end
328
338
  options.on('--status-file=FILE',
329
339
  String,
330
340
  "Name of status file. effective only with daemon command. default is `#{Service::DEFAULT_CONFIG.status_file}'."
@@ -462,6 +472,85 @@ module RIMS
462
472
  })
463
473
  }
464
474
  end
475
+ options.on('--line-length-limit=SIZE',
476
+ Integer
477
+ ) do |size|
478
+ build.chain{|c|
479
+ c.load(protocol: {
480
+ line_length_limit: size
481
+ })
482
+ }
483
+ end
484
+ options.on('--literal-size-limit=SIZE',
485
+ Integer
486
+ ) do |size|
487
+ build.chain{|c|
488
+ c.load(protocol: {
489
+ literal_size_limit: size
490
+ })
491
+ }
492
+ end
493
+ options.on('--command-size-limit=SIZE',
494
+ Integer
495
+ ) do |size|
496
+ build.chain{|c|
497
+ c.load(protocol: {
498
+ command_size_limit: size
499
+ })
500
+ }
501
+ end
502
+ options.on('--[no-]use-default-charset-aliases'
503
+ ) do |use_default_aliases|
504
+ build.chain{|c|
505
+ c.load(charset: {
506
+ use_default_aliases: use_default_aliases
507
+ })
508
+ }
509
+ end
510
+ options.on('--add-charset-alias=NAME_TO_ENCODING',
511
+ /\A \S+,\S+ \z/x,
512
+ "Set the alias name and encoding separated with comma (,)."
513
+ ) do |name_to_encoding|
514
+ name, encoding = name_to_encoding.split(',', 2)
515
+ build.chain{|c|
516
+ c.load(charset: {
517
+ aliases: [
518
+ { name: name, encoding: encoding }
519
+ ]
520
+ })
521
+ }
522
+ end
523
+ options.on('--[no-]replace-charset-invalid'
524
+ ) do |replace|
525
+ build.chain{|c|
526
+ c.load(charset: {
527
+ convert_options: {
528
+ replace_invalid_byte_sequence: replace
529
+ }
530
+ })
531
+ }
532
+ end
533
+ options.on('--[no-]replace-charset-undef'
534
+ ) do |replace|
535
+ build.chain{|c|
536
+ c.load(charset: {
537
+ convert_options: {
538
+ replace_undefined_character: replace
539
+ }
540
+ })
541
+ }
542
+ end
543
+ options.on('--charset-replaced-mark=MARK',
544
+ String
545
+ ) do |mark|
546
+ build.chain{|c|
547
+ c.load(charset: {
548
+ convert_options: {
549
+ replaced_mark: mark
550
+ }
551
+ })
552
+ }
553
+ end
465
554
  options.on('--drb-process-num=NUMBER',
466
555
  Integer
467
556
  ) do |num|
@@ -471,6 +560,15 @@ module RIMS
471
560
  })
472
561
  }
473
562
  end
563
+ options.on('--drb-load-limit=SIZE',
564
+ Integer
565
+ ) do |size|
566
+ build.chain{|c|
567
+ c.load(drb_services: {
568
+ load_limit: size
569
+ })
570
+ }
571
+ end
474
572
  options.on('--bulk-response-count=COUNT',
475
573
  Integer) do |count|
476
574
  build.chain{|c|
@@ -481,6 +579,16 @@ module RIMS
481
579
  })
482
580
  }
483
581
  end
582
+ options.on('--bulk-response-size=SIZE',
583
+ Integer) do |size|
584
+ build.chain{|c|
585
+ c.load(drb_services: {
586
+ engine: {
587
+ bulk_response_size: size
588
+ }
589
+ })
590
+ }
591
+ end
484
592
  options.on('--read-lock-timeout=SECONDS',
485
593
  Float
486
594
  ) do |seconds|
@@ -515,7 +623,6 @@ module RIMS
515
623
  }
516
624
  end
517
625
  options.on('--meta-kvs-type=TYPE',
518
- KeyValueStore::FactoryBuilder.plug_in_names,
519
626
  "Choose key-value store type of mailbox meta-data database. default is `" +
520
627
  KeyValueStore::FactoryBuilder.plug_in_names[0] +
521
628
  "'."
@@ -558,7 +665,6 @@ module RIMS
558
665
  }
559
666
  end
560
667
  options.on('--text-kvs-type=TYPE',
561
- KeyValueStore::FactoryBuilder.plug_in_names,
562
668
  "Choose key-value store type of mailbox text-data database. default is `" +
563
669
  KeyValueStore::FactoryBuilder.plug_in_names[0] +
564
670
  "'."
@@ -684,7 +790,6 @@ module RIMS
684
790
  build.chain{|c| c.load(ip_port: port) }
685
791
  end
686
792
  options.on('--kvs-type=TYPE',
687
- KeyValueStore::FactoryBuilder.plug_in_names,
688
793
  'Deplicated.'
689
794
  ) do |kvs_type|
690
795
  warn("warning: `--kvs-type=TYPE' is deplicated option and should use `--meta-kvs-type=TYPE' or `--text-kvs-type=TYPE'.")
@@ -1074,6 +1179,7 @@ module RIMS
1074
1179
  Riser::Daemon.start_daemon(daemonize: svc_conf.daemonize?,
1075
1180
  daemon_name: svc_conf.daemon_name,
1076
1181
  daemon_debug: svc_conf.daemon_debug?,
1182
+ daemon_umask: svc_conf.daemon_umask,
1077
1183
  status_file: svc_conf.status_file,
1078
1184
  listen_address: proc{
1079
1185
  # to reload on server restart