farcall 0.1.1 → 0.1.2
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/README.md +40 -10
- data/farcall.gemspec +6 -3
- data/lib/farcall/boss_transport.rb +3 -0
- data/lib/farcall/transport.rb +6 -2
- data/lib/farcall/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0590f2273cea0df6aa322c05cc5b5b4b75be5da0
|
4
|
+
data.tar.gz: be36bff0dfe37581e19af74308361b9958cdc4a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d400f0595d4b54caeff4f8c09eacc5282b5fdf23b5eb57b4c5f5a5620ad82d2e95d7520212b655a0f29a9fc4fd0e79161c2f236fe51f3b28536327c3277e634
|
7
|
+
data.tar.gz: 680ead9d24db0a9fc2b6b09c2c40c661030ad1917f91ddff132d6c85de92625ea269e02ec44616be135decdac714067e8e77050374a08720917bf53a52bb4a52
|
data/README.md
CHANGED
@@ -1,16 +1,11 @@
|
|
1
1
|
# Farcall
|
2
2
|
|
3
|
-
## Important!
|
4
|
-
|
5
|
-
The gem creation is under active development, current state is: beta. The JSON and
|
6
|
-
(BOSS)[https://github.com/sergeych/boss_protocol] formats are supported out of the box,
|
7
|
-
thogh XML and other could be easily implemented.
|
8
|
-
|
9
3
|
## Description
|
10
4
|
|
11
5
|
The simple and elegant cross-platform RPC protocol that uses any formatter/transport capable of
|
12
|
-
transmitting dictionary-like objects, for example, JSON,
|
13
|
-
|
6
|
+
transmitting dictionary-like objects, for example, JSON,
|
7
|
+
[BOSS](https://github.com/sergeych/boss_protocol), XML, BSON and many others. This gem
|
8
|
+
supports out of the box JSON and [BOSS](https://github.com/sergeych/boss_protocol) protocols.
|
14
9
|
|
15
10
|
RPC is made asynchronously, each call can have any return values. While one call is waiting,
|
16
11
|
other calls can be executed. The protocol is bidirectional Call parameters could be
|
@@ -18,7 +13,9 @@ both arrays of arguments and keyword arguments, return value could be any object
|
|
18
13
|
dictionary, wahtever.
|
19
14
|
|
20
15
|
Exception/errors transmitting is also supported. The interface is very simple and rubyish. The
|
21
|
-
protocol is very easy to
|
16
|
+
protocol is very easy to implement if there is no implementation, see
|
17
|
+
[Farcall protocol specification](https://github.com/sergeych/farcall/wiki). Java library for
|
18
|
+
Android and desktop is coming soon.
|
22
19
|
|
23
20
|
## Installation
|
24
21
|
|
@@ -94,8 +91,41 @@ More creation options ofr both provider and interface creation are:
|
|
94
91
|
* `input:` and `output:` should be presented both or none - override `socket` - provide streams to
|
95
92
|
build the transport over.
|
96
93
|
|
94
|
+
## guessing JSON or BOSS
|
95
|
+
|
96
|
+
Each one has its pros and contras.
|
97
|
+
|
98
|
+
JSON is widely accepted, and there is a JSON support in literally any platform. It is to some extent
|
99
|
+
human readable (well, without line breaks - almost not ;). Still, it has no support for data
|
100
|
+
date/time types so you should convert them somehow, its support for UTF8 is a myth (almost everywhere
|
101
|
+
almost all UTF8 characters are escaped so the text gets many times bigger when transfering). The
|
102
|
+
binary data has to be converted to some text form too, like base64. All this compensate its goods.
|
103
|
+
The same, except for UTF8, is right for XML.
|
104
|
+
|
105
|
+
[BOSS](https://github.com/sergeych/boss_protocol) is not widely used, and known to me implementations
|
106
|
+
exist only for Ruby, Java, Python and I've heard of ObjectiveC implementation. But it is very space-
|
107
|
+
effective, can effectively transfer binary data, date/time objects and unlimited length integer out
|
108
|
+
of the box. If caches string so when passing large object trees with same keys it provides very
|
109
|
+
effective data. It is even more comact that Python's pickle, Ruby's marshalled objects and Java
|
110
|
+
serialized data. Ideal to fast command transfering when reaction time matters, or network speed is
|
111
|
+
low.
|
112
|
+
|
113
|
+
So, I would recommend:
|
114
|
+
|
115
|
+
- of you transfer small data portions limited to JSON data types, use JSON
|
116
|
+
|
117
|
+
- if you transfer UTF8 texts with national characters, use BOSS
|
118
|
+
|
119
|
+
- if you transfer audio, video, images, large arrays and hashes - use BOSS
|
120
|
+
|
121
|
+
- if you need BOSS but can't find it on your platform, use both and contact me :)
|
122
|
+
|
123
|
+
## Documentation
|
124
|
+
|
125
|
+
* [Farcall protocol](https://github.com/sergeych/farcall/wiki)
|
126
|
+
|
97
127
|
|
98
|
-
|
128
|
+
* Gem [online docs](http://www.rubydoc.info/gems/farcall)
|
99
129
|
|
100
130
|
## Contributing
|
101
131
|
|
data/farcall.gemspec
CHANGED
@@ -8,9 +8,12 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Farcall::VERSION
|
9
9
|
spec.authors = ["sergeych"]
|
10
10
|
spec.email = ["real.sergeych@gmail.com"]
|
11
|
-
spec.summary = %q{Simple, elegant and cross-platofrm
|
12
|
-
spec.description =
|
13
|
-
|
11
|
+
spec.summary = %q{Simple, elegant and cross-platofrm RPC protocol}
|
12
|
+
spec.description = <<-End
|
13
|
+
Simple and effective cross-platform RPC protocol. Can work with any transport capable to
|
14
|
+
pass structures (dictionaries, hashes, whatever you name it). Out of the box provides
|
15
|
+
JSON and BOSS formats over streams and sockets.
|
16
|
+
End
|
14
17
|
spec.homepage = ""
|
15
18
|
spec.license = "MIT"
|
16
19
|
|
@@ -1,5 +1,8 @@
|
|
1
1
|
module Farcall
|
2
2
|
|
3
|
+
# Boss transport is more spece-effective than json, supports more data types, and does not need
|
4
|
+
# delimiters to separate packets in the stream. Creation parameters are the same as of
|
5
|
+
# Farcall::Transport
|
3
6
|
class BossTransport < Farcall::Transport
|
4
7
|
include TransportBase
|
5
8
|
|
data/lib/farcall/transport.rb
CHANGED
@@ -45,8 +45,6 @@ module Farcall
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
attr :closed
|
49
|
-
|
50
48
|
# Tansport must call this process on each incoming hash
|
51
49
|
# passing it as the only parameter, e.g. self.on_data_received(hash)
|
52
50
|
attr_accessor :on_data_received, :on_abort, :on_close
|
@@ -68,12 +66,18 @@ module Farcall
|
|
68
66
|
@on_close and @on_close.call
|
69
67
|
end
|
70
68
|
|
69
|
+
def closed?
|
70
|
+
@closed
|
71
|
+
end
|
72
|
+
|
71
73
|
protected
|
72
74
|
|
75
|
+
# Call it when your connection is closed
|
73
76
|
def connection_closed
|
74
77
|
close
|
75
78
|
end
|
76
79
|
|
80
|
+
# Call it when the connection is aborted due to an exception
|
77
81
|
def connection_aborted exceptoin
|
78
82
|
STDERR.puts "Farcall: connection aborted: #{$!.class.name}: #{$!}"
|
79
83
|
@on_abort and @on_abort.call $!
|
data/lib/farcall/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: farcall
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sergeych
|
@@ -66,9 +66,10 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 1.4.1
|
69
|
-
description:
|
70
|
-
|
71
|
-
|
69
|
+
description: |2
|
70
|
+
Simple and effective cross-platform RPC protocol. Can work with any transport capable to
|
71
|
+
pass structures (dictionaries, hashes, whatever you name it). Out of the box provides
|
72
|
+
JSON and BOSS formats over streams and sockets.
|
72
73
|
email:
|
73
74
|
- real.sergeych@gmail.com
|
74
75
|
executables: []
|
@@ -115,7 +116,7 @@ rubyforge_project:
|
|
115
116
|
rubygems_version: 2.4.5
|
116
117
|
signing_key:
|
117
118
|
specification_version: 4
|
118
|
-
summary: Simple, elegant and cross-platofrm
|
119
|
+
summary: Simple, elegant and cross-platofrm RPC protocol
|
119
120
|
test_files:
|
120
121
|
- spec/endpoint_spec.rb
|
121
122
|
- spec/rmi_spec.rb
|