universa 3.11.4.2 → 3.11.4.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 +4 -4
- data/.gitignore +1 -0
- data/bin/umi/bin/umi +1 -1
- data/bin/umi/bin/umi.bat +1 -1
- data/bin/umi/lib/{com.icodici.umi-0.8.57.jar → com.icodici.umi-0.8.58.jar} +0 -0
- data/lib/universa/contract.rb +5 -3
- data/lib/universa/lazy.rb +73 -0
- data/lib/universa/umi.rb +0 -4
- data/lib/universa/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecdb1da351f0651000bc274335423714f448538235a3061462059d1f47e4c64f
|
4
|
+
data.tar.gz: fb3eec37f962b4b9f833e5cf9ec02684609fbf2817102ee224c22bcfb8619f34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04f306bb9766b8972f47cc3c66a54924dbe4d4a82d1e6600bbed710319304c9bd584867b1c0128598bad58634ad89a3beddafd501a96a9dd26b80c1672a631c8
|
7
|
+
data.tar.gz: 8f2572a74a9f7b014c415759d9e58fadcb953312fbcf158dd2d7d94534406c9e38a5d93639f4cf20a565c1573e67999a5f0e25b68c9a5ce5e592dbccabed9305
|
data/.gitignore
CHANGED
data/bin/umi/bin/umi
CHANGED
@@ -344,7 +344,7 @@ declare -r lib_dir="$(realpath "${app_home}/../lib")"
|
|
344
344
|
declare -a app_mainclass=(com.icodici.farcallscala.Main)
|
345
345
|
|
346
346
|
declare -r script_conf_file="${app_home}/../conf/application.ini"
|
347
|
-
declare -r app_classpath="$lib_dir/com.icodici.umi-0.8.
|
347
|
+
declare -r app_classpath="$lib_dir/com.icodici.umi-0.8.58.jar:$lib_dir/org.scala-lang.scala-library-2.12.7.jar:$lib_dir/com.icodici.universa_core-3.11.4.2.jar:$lib_dir/org.yaml.snakeyaml-1.18.jar:$lib_dir/com.icodici.nanohttpd-2.1.0.jar:$lib_dir/com.icodici.common_tools-3.11.4.2.jar:$lib_dir/com.eclipsesource.minimal-json.minimal-json-0.9.4.jar:$lib_dir/net.java.dev.jna.jna-4.5.1.jar:$lib_dir/org.checkerframework.checker-qual-2.3.2.jar:$lib_dir/com.icodici.crypto-3.11.4.2.jar:$lib_dir/org.bouncycastle.bcprov-jdk15on-1.62.jar:$lib_dir/com.squareup.jnagmp.jnagmp-2.0.0.jar:$lib_dir/com.typesafe.play.play-json_2.12-2.6.10.jar:$lib_dir/com.typesafe.play.play-functional_2.12-2.6.10.jar:$lib_dir/org.scala-lang.scala-reflect-2.12.7.jar:$lib_dir/org.typelevel.macro-compat_2.12-1.1.1.jar:$lib_dir/joda-time.joda-time-2.9.9.jar:$lib_dir/com.fasterxml.jackson.core.jackson-core-2.8.11.jar:$lib_dir/com.fasterxml.jackson.core.jackson-annotations-2.8.11.jar:$lib_dir/com.fasterxml.jackson.datatype.jackson-datatype-jdk8-2.8.11.jar:$lib_dir/com.fasterxml.jackson.core.jackson-databind-2.8.11.1.jar:$lib_dir/com.fasterxml.jackson.datatype.jackson-datatype-jsr310-2.8.11.jar:$lib_dir/org.scala-sbt.ipcsocket.ipcsocket-1.0.0.jar:$lib_dir/net.java.dev.jna.jna-platform-4.5.0.jar:$lib_dir/net.sf.jopt-simple.jopt-simple-4.9.jar"
|
348
348
|
|
349
349
|
# java_cmd is overrode in process_args when -java-home is used
|
350
350
|
declare java_cmd=$(get_java_cmd)
|
data/bin/umi/bin/umi.bat
CHANGED
@@ -80,7 +80,7 @@ rem "-J" is stripped, "-D" is left as is, and everything is appended to JAVA_OPT
|
|
80
80
|
set _JAVA_PARAMS=
|
81
81
|
set _APP_ARGS=
|
82
82
|
|
83
|
-
set "APP_CLASSPATH=%APP_LIB_DIR%\com.icodici.umi-0.8.
|
83
|
+
set "APP_CLASSPATH=%APP_LIB_DIR%\com.icodici.umi-0.8.58.jar;%APP_LIB_DIR%\org.scala-lang.scala-library-2.12.7.jar;%APP_LIB_DIR%\com.icodici.universa_core-3.11.4.2.jar;%APP_LIB_DIR%\org.yaml.snakeyaml-1.18.jar;%APP_LIB_DIR%\com.icodici.nanohttpd-2.1.0.jar;%APP_LIB_DIR%\com.icodici.common_tools-3.11.4.2.jar;%APP_LIB_DIR%\com.eclipsesource.minimal-json.minimal-json-0.9.4.jar;%APP_LIB_DIR%\net.java.dev.jna.jna-4.5.1.jar;%APP_LIB_DIR%\org.checkerframework.checker-qual-2.3.2.jar;%APP_LIB_DIR%\com.icodici.crypto-3.11.4.2.jar;%APP_LIB_DIR%\org.bouncycastle.bcprov-jdk15on-1.62.jar;%APP_LIB_DIR%\com.squareup.jnagmp.jnagmp-2.0.0.jar;%APP_LIB_DIR%\com.typesafe.play.play-json_2.12-2.6.10.jar;%APP_LIB_DIR%\com.typesafe.play.play-functional_2.12-2.6.10.jar;%APP_LIB_DIR%\org.scala-lang.scala-reflect-2.12.7.jar;%APP_LIB_DIR%\org.typelevel.macro-compat_2.12-1.1.1.jar;%APP_LIB_DIR%\joda-time.joda-time-2.9.9.jar;%APP_LIB_DIR%\com.fasterxml.jackson.core.jackson-core-2.8.11.jar;%APP_LIB_DIR%\com.fasterxml.jackson.core.jackson-annotations-2.8.11.jar;%APP_LIB_DIR%\com.fasterxml.jackson.datatype.jackson-datatype-jdk8-2.8.11.jar;%APP_LIB_DIR%\com.fasterxml.jackson.core.jackson-databind-2.8.11.1.jar;%APP_LIB_DIR%\com.fasterxml.jackson.datatype.jackson-datatype-jsr310-2.8.11.jar;%APP_LIB_DIR%\org.scala-sbt.ipcsocket.ipcsocket-1.0.0.jar;%APP_LIB_DIR%\net.java.dev.jna.jna-platform-4.5.0.jar;%APP_LIB_DIR%\net.sf.jopt-simple.jopt-simple-4.9.jar"
|
84
84
|
set "APP_MAIN_CLASS=com.icodici.farcallscala.Main"
|
85
85
|
set "SCRIPT_CONF_FILE=%APP_HOME%\conf\application.ini"
|
86
86
|
|
Binary file
|
data/lib/universa/contract.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'bigdecimal'
|
2
|
+
require 'universa/lazy'
|
2
3
|
|
3
4
|
module Universa
|
4
5
|
|
@@ -146,15 +147,16 @@ module Universa
|
|
146
147
|
#
|
147
148
|
# @return [String] binary string
|
148
149
|
def bytes
|
149
|
-
get_digest
|
150
|
+
@bytes ||= get_digest
|
150
151
|
end
|
151
152
|
|
153
|
+
|
152
154
|
# Get string representation. It is, actually, base64 encoded string representation. Longer, but could easily
|
153
155
|
# be transferred with text protocols.
|
154
156
|
#
|
155
157
|
# @return [String] string representation
|
156
158
|
def to_s
|
157
|
-
Base64.encode64(get_digest).gsub(/\s/, '')
|
159
|
+
@str ||= Base64.encode64(get_digest).gsub(/\s/, '')
|
158
160
|
end
|
159
161
|
|
160
162
|
# Converts to URL-safe varianot of base64, as RFC 3548 suggests:
|
@@ -164,7 +166,7 @@ module Universa
|
|
164
166
|
# Could be decoded safely back with {HashId.from_string} but not (most likely) with JAVA API itself
|
165
167
|
# @return [String] RFC3548 modified base64
|
166
168
|
def to_url_safe_string
|
167
|
-
Base64.encode64(get_digest).gsub(/\s/, '').gsub('/', '_').gsub('+', '-')
|
169
|
+
@urlsafe_str ||= Base64.encode64(get_digest).gsub(/\s/, '').gsub('/', '_').gsub('+', '-')
|
168
170
|
end
|
169
171
|
|
170
172
|
# To use it as a hash key_address.
|
@@ -0,0 +1,73 @@
|
|
1
|
+
module Universa
|
2
|
+
|
3
|
+
# Experimental!
|
4
|
+
#
|
5
|
+
# Memoizable lazy pattern. A value that is calculated only once and onlywhen first time {get} is called.
|
6
|
+
# LazyValue is thread-safe and calculates its value exactly once.
|
7
|
+
class LazyValue
|
8
|
+
|
9
|
+
# initialize lazy value with an optional initializer block. If no initializer block is given, then
|
10
|
+
# {get} call must provide one.
|
11
|
+
def initialize(&block)
|
12
|
+
@value = nil
|
13
|
+
@ready = false
|
14
|
+
@initializer = block
|
15
|
+
@mutex = Mutex.new
|
16
|
+
end
|
17
|
+
|
18
|
+
# Get the value, calculating it using initializer block specified in the params or at creation time
|
19
|
+
# if no block is provided
|
20
|
+
def get(&block)
|
21
|
+
@mutex.synchronize {
|
22
|
+
if @ready
|
23
|
+
@value
|
24
|
+
else
|
25
|
+
@initializer = block if block
|
26
|
+
@value = @initializer.call
|
27
|
+
@ready = true
|
28
|
+
@value
|
29
|
+
end
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# causes value to be recalculated on next call to {get}
|
34
|
+
def clear
|
35
|
+
@ready = false
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Add class-level lazy declaration like:
|
40
|
+
#
|
41
|
+
# class Test
|
42
|
+
# lazy(:foo) {
|
43
|
+
# puts "foo calculated"
|
44
|
+
# "bar"
|
45
|
+
# }
|
46
|
+
#
|
47
|
+
# t = Test.new
|
48
|
+
# t.foo # "foo calculated" -> "bar"
|
49
|
+
# t.foo #=> "bar"
|
50
|
+
#
|
51
|
+
module Lazy
|
52
|
+
|
53
|
+
# prevent from creation multiple instances of LazyValue's
|
54
|
+
@@lazy_creation_mutex = Mutex.new
|
55
|
+
|
56
|
+
def Lazy.included(other)
|
57
|
+
# implement class-level lazy instance var definition
|
58
|
+
def other.lazy(name, &block)
|
59
|
+
define_method(name.to_sym) {
|
60
|
+
x = @@lazy_creation_mutex.synchronize {
|
61
|
+
cache_name = :"@__#{name}__cache"
|
62
|
+
if !(x = instance_variable_get(cache_name))
|
63
|
+
x = LazyValue.new { instance_exec &block }
|
64
|
+
instance_variable_set(cache_name, x)
|
65
|
+
end
|
66
|
+
x
|
67
|
+
}
|
68
|
+
x.get
|
69
|
+
}
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
data/lib/universa/umi.rb
CHANGED
@@ -127,10 +127,6 @@ module Universa
|
|
127
127
|
encode_result result
|
128
128
|
end
|
129
129
|
|
130
|
-
def invoke_static(class_name, method, *args)
|
131
|
-
encode_result call("invoke", class_name, method.to_s.camelize_lower, *prepare_args(args))
|
132
|
-
end
|
133
|
-
|
134
130
|
def get_field(remote_object, name)
|
135
131
|
encode_result call("get_field", remote_object._remote_id, name)
|
136
132
|
end
|
data/lib/universa/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: universa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.11.4.
|
4
|
+
version: 3.11.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sergeych
|
@@ -154,7 +154,7 @@ files:
|
|
154
154
|
- bin/umi/lib/com.icodici.common_tools-3.11.4.2.jar
|
155
155
|
- bin/umi/lib/com.icodici.crypto-3.11.4.2.jar
|
156
156
|
- bin/umi/lib/com.icodici.nanohttpd-2.1.0.jar
|
157
|
-
- bin/umi/lib/com.icodici.umi-0.8.
|
157
|
+
- bin/umi/lib/com.icodici.umi-0.8.58.jar
|
158
158
|
- bin/umi/lib/com.icodici.universa_core-3.11.4.2.jar
|
159
159
|
- bin/umi/lib/com.squareup.jnagmp.jnagmp-2.0.0.jar
|
160
160
|
- bin/umi/lib/com.typesafe.play.play-functional_2.12-2.6.10.jar
|
@@ -183,6 +183,7 @@ files:
|
|
183
183
|
- lib/universa/fs_store/file_store.rb
|
184
184
|
- lib/universa/keys.rb
|
185
185
|
- lib/universa/keytool/keytool.rb
|
186
|
+
- lib/universa/lazy.rb
|
186
187
|
- lib/universa/service.rb
|
187
188
|
- lib/universa/stored_contract.rb
|
188
189
|
- lib/universa/string_utils.rb
|