scalaroid 0.0.2 → 0.0.3

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
  SHA1:
3
- metadata.gz: ebb984a4a84bf062f362565b3dcb99024d272133
4
- data.tar.gz: 8bf7ab7c403ac124cea9b35734849fa56d3f4abe
3
+ metadata.gz: 408ea6371f2ee4785dacc260aae221a73c8dd32d
4
+ data.tar.gz: c91fad72c77baa55dc50148d4516da3e242e8fb6
5
5
  SHA512:
6
- metadata.gz: ef3074ccc62dce91e386cbd276ee5d209527f66e6d510bae3dc788f566a4db992d3c98522857d328011af2abd48468b121022ad1b3a0e442578ca1801ef9084d
7
- data.tar.gz: 8925be104f80a04795d88dbc5f1c4239a558286d9db4d81b3fb2ad2fcfd6f9e25c49917681ba48c085fd2d64ea90a00d2612d0ae5fa8b836557a3597dbe2a896
6
+ metadata.gz: b21dd9f5bd21031254d929cda0513648b2cec594c48cde726c90b7c7d39f80b5f0f7df3983b720a3490da4a9a56d2ddd3a26a0b6302bca0769cc51af6205fc57
7
+ data.tar.gz: 9d75f1d189ce09dfbb52de2f08f87baf5b1e498f83c5c4f1b793d35e0aeab98d7b35a2cc846222a70b791b49c5980243589324f1c12e05e2ae19e40bdf29abe1
@@ -0,0 +1,77 @@
1
+ module Scalaroid
2
+ # Base class for errors in the scalaris package.
3
+ class ScalarisError < StandardError
4
+ end
5
+
6
+ # Exception that is thrown if a the commit of a write operation on a Scalaris
7
+ # ring fails.
8
+ class AbortError < ScalarisError
9
+ attr_reader :raw_result
10
+ attr_reader :failed_keys
11
+ def initialize(raw_result, failed_keys)
12
+ @raw_result = raw_result
13
+ @failed_keys = failed_keys
14
+ end
15
+
16
+ def to_s
17
+ @raw_result
18
+ end
19
+ end
20
+
21
+ # Exception that is thrown if an operation on a Scalaris ring fails because
22
+ # a connection does not exist or has been disconnected.
23
+ class ConnectionError < ScalarisError
24
+ include InternalScalarisSimpleError
25
+ end
26
+
27
+ # Exception that is thrown if a test_and_set operation on a Scalaris ring
28
+ # fails because the old value did not match the expected value.
29
+ class KeyChangedError < ScalarisError
30
+ attr_reader :raw_result
31
+ attr_reader :old_value
32
+ def initialize(raw_result, old_value)
33
+ @raw_result = raw_result
34
+ @old_value = old_value
35
+ end
36
+
37
+ def to_s
38
+ @raw_result + ", old value: " + @old_value
39
+ end
40
+ end
41
+
42
+ # Exception that is thrown if a delete operation on a Scalaris ring fails
43
+ # because no Scalaris node was found.
44
+ class NodeNotFoundError < ScalarisError
45
+ include InternalScalarisSimpleError
46
+ end
47
+
48
+ # Exception that is thrown if a read operation on a Scalaris ring fails
49
+ # because the key did not exist before.
50
+ class NotFoundError < ScalarisError
51
+ include InternalScalarisSimpleError
52
+ end
53
+
54
+ # Exception that is thrown if a add_del_on_list operation on a scalaris ring
55
+ # fails because the participating values are not lists.
56
+ class NotAListError < ScalarisError
57
+ include InternalScalarisSimpleError
58
+ end
59
+
60
+ # Exception that is thrown if a add_del_on_list operation on a scalaris ring
61
+ # fails because the participating values are not numbers.
62
+ class NotANumberError < ScalarisError
63
+ include InternalScalarisSimpleError
64
+ end
65
+
66
+ # Exception that is thrown if a read or write operation on a Scalaris ring
67
+ # fails due to a timeout.
68
+ class TimeoutError < ScalarisError
69
+ include InternalScalarisSimpleError
70
+ end
71
+
72
+ # Generic exception that is thrown during operations on a Scalaris ring, e.g.
73
+ # if an unknown result has been returned.
74
+ class UnknownError < ScalarisError
75
+ include InternalScalarisSimpleError
76
+ end
77
+ end
@@ -1,3 +1,3 @@
1
1
  module Scalaroid
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/scalaroid.gemspec CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "scalaroid"
9
- s.version = "0.0.2"
9
+ s.version = "0.0.3"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
27
27
  "bin/scalaroid",
28
28
  "lib/scalaroid.rb",
29
29
  "lib/scalaroid/delete_result.rb",
30
+ "lib/scalaroid/errors.rb",
30
31
  "lib/scalaroid/json_connection.rb",
31
32
  "lib/scalaroid/json_req_list.rb",
32
33
  "lib/scalaroid/json_req_list_transaction.rb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scalaroid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Teodor Pripoae
@@ -96,6 +96,7 @@ files:
96
96
  - bin/scalaroid
97
97
  - lib/scalaroid.rb
98
98
  - lib/scalaroid/delete_result.rb
99
+ - lib/scalaroid/errors.rb
99
100
  - lib/scalaroid/json_connection.rb
100
101
  - lib/scalaroid/json_req_list.rb
101
102
  - lib/scalaroid/json_req_list_transaction.rb