tarantool-model 0.1.0 → 0.3.0
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/CHANGELOG.md +16 -1
- data/README.md +123 -15
- data/lib/tarantool/model/errors.rb +11 -0
- data/lib/tarantool/model/locking.rb +90 -0
- data/lib/tarantool/model/persistence.rb +10 -2
- data/lib/tarantool/model/settings.rb +10 -1
- data/lib/tarantool/model/storage/box/layout.rb +1 -10
- data/lib/tarantool/model/storage/box.rb +14 -25
- data/lib/tarantool/model/storage/crud.rb +2 -0
- data/lib/tarantool/model/testing/memory_storage/box_mode.rb +49 -0
- data/lib/tarantool/model/testing/memory_storage/crud_mode.rb +81 -0
- data/lib/tarantool/model/testing/memory_storage/declaration.rb +54 -0
- data/lib/tarantool/model/testing/memory_storage/index_declaration.rb +78 -0
- data/lib/tarantool/model/testing/memory_storage/keys.rb +38 -0
- data/lib/tarantool/model/testing/memory_storage/operations.rb +38 -0
- data/lib/tarantool/model/testing/memory_storage/order.rb +44 -0
- data/lib/tarantool/model/testing/memory_storage/scan.rb +82 -0
- data/lib/tarantool/model/testing/memory_storage/sequence.rb +28 -0
- data/lib/tarantool/model/testing/memory_storage/space.rb +141 -0
- data/lib/tarantool/model/testing/memory_storage/violation.rb +71 -0
- data/lib/tarantool/model/testing/memory_storage.rb +99 -0
- data/lib/tarantool/model/testing.rb +17 -0
- data/lib/tarantool/model/version.rb +1 -1
- data/lib/tarantool/model.rb +18 -0
- metadata +18 -4
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'tarantool/model'
|
|
4
|
+
require 'zlib'
|
|
5
|
+
|
|
6
|
+
require_relative 'testing/memory_storage/keys'
|
|
7
|
+
require_relative 'testing/memory_storage/violation'
|
|
8
|
+
require_relative 'testing/memory_storage/index_declaration'
|
|
9
|
+
require_relative 'testing/memory_storage/declaration'
|
|
10
|
+
require_relative 'testing/memory_storage/operations'
|
|
11
|
+
require_relative 'testing/memory_storage/order'
|
|
12
|
+
require_relative 'testing/memory_storage/scan'
|
|
13
|
+
require_relative 'testing/memory_storage/sequence'
|
|
14
|
+
require_relative 'testing/memory_storage/space'
|
|
15
|
+
require_relative 'testing/memory_storage/box_mode'
|
|
16
|
+
require_relative 'testing/memory_storage/crud_mode'
|
|
17
|
+
require_relative 'testing/memory_storage'
|
data/lib/tarantool/model.rb
CHANGED
|
@@ -15,6 +15,7 @@ require_relative 'model/types/binary'
|
|
|
15
15
|
require_relative 'model/settings'
|
|
16
16
|
require_relative 'model/state'
|
|
17
17
|
require_relative 'model/persistence'
|
|
18
|
+
require_relative 'model/locking'
|
|
18
19
|
require_relative 'model/counters'
|
|
19
20
|
require_relative 'model/relation'
|
|
20
21
|
require_relative 'model/querying'
|
|
@@ -27,6 +28,22 @@ module Tarantool
|
|
|
27
28
|
module Model
|
|
28
29
|
extend ActiveSupport::Concern
|
|
29
30
|
|
|
31
|
+
DEFAULT_STORAGE_LOCK = Mutex.new
|
|
32
|
+
private_constant :DEFAULT_STORAGE_LOCK
|
|
33
|
+
|
|
34
|
+
class << self
|
|
35
|
+
# Storage for models that set none of their own: a storage, or a Proc called once on first use.
|
|
36
|
+
attr_writer :default_storage
|
|
37
|
+
|
|
38
|
+
def default_storage
|
|
39
|
+
DEFAULT_STORAGE_LOCK.synchronize do
|
|
40
|
+
@default_storage = @default_storage.call if @default_storage.is_a?(Proc)
|
|
41
|
+
|
|
42
|
+
@default_storage
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
30
47
|
include ActiveModel::API
|
|
31
48
|
include ActiveModel::Attributes
|
|
32
49
|
include ActiveModel::Dirty
|
|
@@ -35,6 +52,7 @@ module Tarantool
|
|
|
35
52
|
include Settings
|
|
36
53
|
include State
|
|
37
54
|
include Persistence
|
|
55
|
+
include Locking
|
|
38
56
|
include Counters
|
|
39
57
|
include Transactional
|
|
40
58
|
include Querying
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tarantool-model
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Starlexxx
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activemodel
|
|
@@ -36,14 +36,14 @@ dependencies:
|
|
|
36
36
|
requirements:
|
|
37
37
|
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: 0.
|
|
39
|
+
version: 0.2.0
|
|
40
40
|
type: :runtime
|
|
41
41
|
prerelease: false
|
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
|
43
43
|
requirements:
|
|
44
44
|
- - "~>"
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: 0.
|
|
46
|
+
version: 0.2.0
|
|
47
47
|
description: Attributes, validations, callbacks, dirty tracking and index-based queries
|
|
48
48
|
with keyset pagination over Tarantool 2.11+ and 3.x spaces, through tarantool-client
|
|
49
49
|
or tarantool-crud.
|
|
@@ -60,6 +60,7 @@ files:
|
|
|
60
60
|
- lib/tarantool/model/counters.rb
|
|
61
61
|
- lib/tarantool/model/errors.rb
|
|
62
62
|
- lib/tarantool/model/key.rb
|
|
63
|
+
- lib/tarantool/model/locking.rb
|
|
63
64
|
- lib/tarantool/model/persistence.rb
|
|
64
65
|
- lib/tarantool/model/querying.rb
|
|
65
66
|
- lib/tarantool/model/relation.rb
|
|
@@ -69,6 +70,19 @@ files:
|
|
|
69
70
|
- lib/tarantool/model/storage/box.rb
|
|
70
71
|
- lib/tarantool/model/storage/box/layout.rb
|
|
71
72
|
- lib/tarantool/model/storage/crud.rb
|
|
73
|
+
- lib/tarantool/model/testing.rb
|
|
74
|
+
- lib/tarantool/model/testing/memory_storage.rb
|
|
75
|
+
- lib/tarantool/model/testing/memory_storage/box_mode.rb
|
|
76
|
+
- lib/tarantool/model/testing/memory_storage/crud_mode.rb
|
|
77
|
+
- lib/tarantool/model/testing/memory_storage/declaration.rb
|
|
78
|
+
- lib/tarantool/model/testing/memory_storage/index_declaration.rb
|
|
79
|
+
- lib/tarantool/model/testing/memory_storage/keys.rb
|
|
80
|
+
- lib/tarantool/model/testing/memory_storage/operations.rb
|
|
81
|
+
- lib/tarantool/model/testing/memory_storage/order.rb
|
|
82
|
+
- lib/tarantool/model/testing/memory_storage/scan.rb
|
|
83
|
+
- lib/tarantool/model/testing/memory_storage/sequence.rb
|
|
84
|
+
- lib/tarantool/model/testing/memory_storage/space.rb
|
|
85
|
+
- lib/tarantool/model/testing/memory_storage/violation.rb
|
|
72
86
|
- lib/tarantool/model/transactional.rb
|
|
73
87
|
- lib/tarantool/model/transactions.rb
|
|
74
88
|
- lib/tarantool/model/types/binary.rb
|