wolf_core 0.1.78 → 0.1.80
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da9921ce6c80a5f8eda1e4eb5902e987deb6e8203460c450e34a2d42f61748f7
|
4
|
+
data.tar.gz: b16b4942decf529b1beb9b1a521923b065134f84690b63cfc25c92f680f5af8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f28624e070f4d6f5943f14977bcf80c1e3787a8420798a32a6349ff2a0607b37f0dfce11f347e7bd2b20c0fae6200115ff51568e5195625d7029557ee7b4de4
|
7
|
+
data.tar.gz: 58bfaa27cb3a2bd62105c061c78d58612a312c3b3be38565ba521461be37c1aa3eba575aad43e9973689e3ee0442b315e00b6de0f27985e9c2f9435615d24233
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module WolfCore
|
2
|
+
module InMemoryStorageDataSource
|
3
|
+
module_function
|
4
|
+
|
5
|
+
def init
|
6
|
+
@@redis = Redis.new(host: ENV['REDIS_ENDPOINT'])
|
7
|
+
end
|
8
|
+
|
9
|
+
def instance
|
10
|
+
@@redis
|
11
|
+
end
|
12
|
+
|
13
|
+
def acquire_lock(key:, value:, expiry:)
|
14
|
+
instance.set("lock:process:#{ENV['TENANT']}:#{key}", value, ex: expiry.to_i, nx: true)
|
15
|
+
end
|
16
|
+
|
17
|
+
def set_non_exp_lock(key:, value:)
|
18
|
+
instance.set("lock:process:#{ENV['TENANT']}:#{key}", value, nx: true)
|
19
|
+
end
|
20
|
+
|
21
|
+
def check_lock(key:)
|
22
|
+
instance.get("lock:process:#{ENV['TENANT']}:#{key}")
|
23
|
+
end
|
24
|
+
|
25
|
+
def release_lock(key:)
|
26
|
+
instance.del("lock:process:#{ENV['TENANT']}:#{key}")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module WolfCore
|
2
|
+
module InMemoryStorageOperations
|
3
|
+
def acquire_lock(key:, value:, expiry:)
|
4
|
+
WolfCore::InMemoryStorageDataSource.acquire_lock(key: key, value: value, expiry: expiry)
|
5
|
+
end
|
6
|
+
|
7
|
+
def set_non_exp_lock(key:, value:)
|
8
|
+
WolfCore::InMemoryStorageDataSource.set_non_exp_lock(key: key, value: value)
|
9
|
+
end
|
10
|
+
|
11
|
+
def check_lock(key:)
|
12
|
+
WolfCore::InMemoryStorageDataSource.check_lock(key: key)
|
13
|
+
end
|
14
|
+
|
15
|
+
def release_lock(key:)
|
16
|
+
WolfCore::InMemoryStorageDataSource.release_lock(key: key)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/wolf_core/version.rb
CHANGED
data/lib/wolf_core.rb
CHANGED
@@ -6,10 +6,12 @@ require 'httparty'
|
|
6
6
|
require 'active_support'
|
7
7
|
require 'active_support/core_ext'
|
8
8
|
require 'aws-sdk-lambda'
|
9
|
+
require 'redis'
|
9
10
|
|
10
11
|
module WolfCore; end
|
11
12
|
|
12
13
|
require 'wolf_core/utils/file_utils'
|
13
14
|
|
14
15
|
WolfCore::FileUtils.require_relative_folder(__dir__, 'wolf_core')
|
15
|
-
WolfCore::LambdaFunctionDataSource.init
|
16
|
+
WolfCore::LambdaFunctionDataSource.init
|
17
|
+
WolfCore::InMemoryStorageDataSource.init
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wolf_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.80
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Javier Roncallo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: redis
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
description: Repository to store shared code among Ruby projects.
|
56
70
|
email:
|
57
71
|
- jroncallo96@gmail.com
|
@@ -70,6 +84,8 @@ files:
|
|
70
84
|
- lib/wolf_core/infrastructure/fkm_operations.rb
|
71
85
|
- lib/wolf_core/infrastructure/http_data_source.rb
|
72
86
|
- lib/wolf_core/infrastructure/http_operations.rb
|
87
|
+
- lib/wolf_core/infrastructure/in_memory_storage_data_source.rb
|
88
|
+
- lib/wolf_core/infrastructure/in_memory_storage_operations.rb
|
73
89
|
- lib/wolf_core/infrastructure/lambda_function_data_source.rb
|
74
90
|
- lib/wolf_core/infrastructure/lambda_function_operations.rb
|
75
91
|
- lib/wolf_core/utils/array_utils.rb
|