lex-swarm 0.2.2 → 0.2.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
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 85e80b69d4a5c1b117ca7dc79fb316da8fcb586128ea1eb4563322b4eeecb20a
|
|
4
|
+
data.tar.gz: 7a8f63f2702b4cf1397471c701a11f1f7b1382c2fb6d9066628fcd760ae37de1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '0853b125fac63372cdf738a5918d7cb78b4ba7c3a62a6057c77336e1c8990700917b1c0ff1c5697566878d75c7e274bc3a9836b15b4e53770aaddd10f6138f06'
|
|
7
|
+
data.tar.gz: c22349af27e6dd8ca93b4de4f5befe59c3d011dc50a7e28c08985efaf743007a75fdd2ba91ebb60769e274a6a7b2ed75ea4d0a6b8eee8dc5a48d4d54ee008183
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'time'
|
|
4
|
-
require_relative '
|
|
4
|
+
require_relative 'workspace'
|
|
5
5
|
|
|
6
6
|
module Legion
|
|
7
7
|
module Extensions
|
|
8
8
|
module Swarm
|
|
9
|
-
module
|
|
9
|
+
module Helpers
|
|
10
10
|
class WorkspaceSync
|
|
11
11
|
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
12
12
|
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'spec_helper'
|
|
4
|
-
require_relative '../../../../../lib/legion/extensions/swarm/
|
|
4
|
+
require_relative '../../../../../lib/legion/extensions/swarm/helpers/workspace_sync'
|
|
5
5
|
|
|
6
|
-
RSpec.describe Legion::Extensions::Swarm::
|
|
7
|
-
subject(:
|
|
6
|
+
RSpec.describe Legion::Extensions::Swarm::Helpers::WorkspaceSync do
|
|
7
|
+
subject(:sync) { described_class.allocate }
|
|
8
8
|
|
|
9
9
|
describe '#publish_change' do
|
|
10
10
|
it 'returns skipped when transport publish fails' do
|
|
11
11
|
allow(Legion::Transport).to receive(:publish).and_raise(StandardError, 'not connected')
|
|
12
|
-
result =
|
|
13
|
-
|
|
12
|
+
result = sync.publish_change(charter_id: 'c1', key: 'k', value: 'v',
|
|
13
|
+
author: 'a', version: 1, operation: :put)
|
|
14
14
|
expect(result[:success]).to be true
|
|
15
15
|
expect(result[:skipped]).to eq(:publish_error)
|
|
16
16
|
end
|
|
@@ -19,10 +19,10 @@ RSpec.describe Legion::Extensions::Swarm::Actors::WorkspaceSync do
|
|
|
19
19
|
describe '#apply_incoming' do
|
|
20
20
|
let(:workspace) { Legion::Extensions::Swarm::Helpers::Workspace.new }
|
|
21
21
|
|
|
22
|
-
before {
|
|
22
|
+
before { sync.instance_variable_set(:@workspace, workspace) }
|
|
23
23
|
|
|
24
24
|
it 'applies a remote put operation' do
|
|
25
|
-
result =
|
|
25
|
+
result = sync.apply_incoming(
|
|
26
26
|
charter_id: 'c1', key: 'shared', value: 'remote-data',
|
|
27
27
|
author: 'remote-agent', version: 1, timestamp: Time.now.utc.to_s, operation: 'put'
|
|
28
28
|
)
|
|
@@ -33,7 +33,7 @@ RSpec.describe Legion::Extensions::Swarm::Actors::WorkspaceSync do
|
|
|
33
33
|
|
|
34
34
|
it 'applies a remote delete operation' do
|
|
35
35
|
workspace.put('c1', key: 'doomed', value: 'bye', author: 'local')
|
|
36
|
-
result =
|
|
36
|
+
result = sync.apply_incoming(
|
|
37
37
|
charter_id: 'c1', key: 'doomed', operation: 'delete'
|
|
38
38
|
)
|
|
39
39
|
expect(result[:success]).to be true
|
|
@@ -41,7 +41,7 @@ RSpec.describe Legion::Extensions::Swarm::Actors::WorkspaceSync do
|
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
it 'rejects unknown operations' do
|
|
44
|
-
result =
|
|
44
|
+
result = sync.apply_incoming(charter_id: 'c1', key: 'x', operation: 'explode')
|
|
45
45
|
expect(result[:success]).to be false
|
|
46
46
|
expect(result[:reason]).to eq(:unknown_operation)
|
|
47
47
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lex-swarm
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Esity
|
|
@@ -133,12 +133,12 @@ files:
|
|
|
133
133
|
- lib/legion/extensions/swarm.rb
|
|
134
134
|
- lib/legion/extensions/swarm/actors/orphan_sweeper.rb
|
|
135
135
|
- lib/legion/extensions/swarm/actors/stale_check.rb
|
|
136
|
-
- lib/legion/extensions/swarm/actors/workspace_sync.rb
|
|
137
136
|
- lib/legion/extensions/swarm/client.rb
|
|
138
137
|
- lib/legion/extensions/swarm/helpers/charter.rb
|
|
139
138
|
- lib/legion/extensions/swarm/helpers/sub_agent.rb
|
|
140
139
|
- lib/legion/extensions/swarm/helpers/swarm_store.rb
|
|
141
140
|
- lib/legion/extensions/swarm/helpers/workspace.rb
|
|
141
|
+
- lib/legion/extensions/swarm/helpers/workspace_sync.rb
|
|
142
142
|
- lib/legion/extensions/swarm/runners/spawn_child.rb
|
|
143
143
|
- lib/legion/extensions/swarm/runners/swarm.rb
|
|
144
144
|
- lib/legion/extensions/swarm/runners/workspace.rb
|