paper_trail_diff 0.17.1 → 0.18.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 +648 -0
- data/QUICKSTART.md +12 -14
- data/README.md +32 -30
- data/docs/architecture.md +65 -29
- data/docs/performance.md +161 -46
- data/docs/reference.md +495 -394
- data/docs/testing.md +9 -15
- data/lib/paper_trail_diff/activity_belongs_to_event_applier.rb +42 -9
- data/lib/paper_trail_diff/activity_boundary.rb +15 -6
- data/lib/paper_trail_diff/activity_child_candidate_loader.rb +91 -18
- data/lib/paper_trail_diff/activity_collection_event_applier.rb +14 -15
- data/lib/paper_trail_diff/activity_collection_record_updater.rb +18 -8
- data/lib/paper_trail_diff/activity_collection_route_updater.rb +12 -25
- data/lib/paper_trail_diff/activity_event.rb +53 -34
- data/lib/paper_trail_diff/activity_event_record_normalizer.rb +12 -26
- data/lib/paper_trail_diff/activity_event_record_resolver.rb +45 -32
- data/lib/paper_trail_diff/activity_event_snapshot_refresher.rb +26 -33
- data/lib/paper_trail_diff/activity_history.rb +28 -34
- data/lib/paper_trail_diff/activity_relationship.rb +3 -26
- data/lib/paper_trail_diff/activity_root_snapshot_refresher.rb +14 -8
- data/lib/paper_trail_diff/activity_snapshot_delta.rb +2 -3
- data/lib/paper_trail_diff/activity_snapshot_sequence.rb +92 -25
- data/lib/paper_trail_diff/activity_timeline_builder.rb +128 -77
- data/lib/paper_trail_diff/activity_transaction_applier.rb +49 -0
- data/lib/paper_trail_diff/activity_tree_filter.rb +70 -57
- data/lib/paper_trail_diff/activity_tree_places.rb +76 -0
- data/lib/paper_trail_diff/activity_version_collector.rb +45 -32
- data/lib/paper_trail_diff/activity_view.rb +2 -0
- data/lib/paper_trail_diff/analysis.rb +6 -5
- data/lib/paper_trail_diff/analysis_batch.rb +21 -17
- data/lib/paper_trail_diff/association_activity_edge.rb +99 -85
- data/lib/paper_trail_diff/association_activity_selection.rb +46 -14
- data/lib/paper_trail_diff/association_discovery.rb +4 -4
- data/lib/paper_trail_diff/association_key.rb +10 -18
- data/lib/paper_trail_diff/association_traversal.rb +72 -92
- data/lib/paper_trail_diff/batch_boundary_resolver.rb +1 -7
- data/lib/paper_trail_diff/batch_preload.rb +2 -3
- data/lib/paper_trail_diff/batched_root_analyses.rb +60 -25
- data/lib/paper_trail_diff/batched_root_analyzer.rb +5 -5
- data/lib/paper_trail_diff/batched_root_versions.rb +7 -30
- data/lib/paper_trail_diff/branch_snapshot_refresher.rb +19 -14
- data/lib/paper_trail_diff/candidate_table.rb +160 -0
- data/lib/paper_trail_diff/change_attribution.rb +15 -23
- data/lib/paper_trail_diff/collection_identity_index.rb +68 -24
- data/lib/paper_trail_diff/collection_transition.rb +3 -3
- data/lib/paper_trail_diff/comparison_batch.rb +13 -6
- data/lib/paper_trail_diff/database_time.rb +85 -0
- data/lib/paper_trail_diff/deleted_analysis_batch.rb +22 -23
- data/lib/paper_trail_diff/deleted_root_filter.rb +10 -6
- data/lib/paper_trail_diff/diagnostics.rb +26 -86
- data/lib/paper_trail_diff/endpoint.rb +37 -5
- data/lib/paper_trail_diff/engine.rb +1 -1
- data/lib/paper_trail_diff/errors.rb +0 -6
- data/lib/paper_trail_diff/exact_column_type.rb +96 -0
- data/lib/paper_trail_diff/historical_snapshot_store.rb +88 -83
- data/lib/paper_trail_diff/instrumentation.rb +0 -8
- data/lib/paper_trail_diff/live_endpoint_batch_loader.rb +1 -4
- data/lib/paper_trail_diff/live_graph_collector.rb +1 -3
- data/lib/paper_trail_diff/nested_comparator.rb +42 -10
- data/lib/paper_trail_diff/paper_trail_adapter.rb +55 -98
- data/lib/paper_trail_diff/prepared_activity_index.rb +214 -182
- data/lib/paper_trail_diff/prepared_child_candidates.rb +13 -3
- data/lib/paper_trail_diff/prepared_edge_loader.rb +11 -49
- data/lib/paper_trail_diff/prepared_history.rb +27 -177
- data/lib/paper_trail_diff/prepared_history_loader.rb +39 -57
- data/lib/paper_trail_diff/prepared_record_index.rb +221 -147
- data/lib/paper_trail_diff/prepared_snapshot_builder.rb +47 -42
- data/lib/paper_trail_diff/prepared_state_association_reader.rb +85 -62
- data/lib/paper_trail_diff/recorded_changes.rb +34 -10
- data/lib/paper_trail_diff/recorded_owner.rb +67 -0
- data/lib/paper_trail_diff/root_version_selection.rb +6 -2
- data/lib/paper_trail_diff/scope_condition.rb +120 -80
- data/lib/paper_trail_diff/scope_ranking.rb +14 -32
- data/lib/paper_trail_diff/scoped_analysis.rb +11 -6
- data/lib/paper_trail_diff/scoped_analysis_builder.rb +17 -11
- data/lib/paper_trail_diff/scoped_root_selection.rb +91 -85
- data/lib/paper_trail_diff/selection_window.rb +31 -0
- data/lib/paper_trail_diff/snapshot.rb +60 -58
- data/lib/paper_trail_diff/snapshot_members.rb +115 -0
- data/lib/paper_trail_diff/snapshot_normalizer.rb +0 -11
- data/lib/paper_trail_diff/step.rb +1 -5
- data/lib/paper_trail_diff/stored_form.rb +146 -0
- data/lib/paper_trail_diff/stored_json_values.rb +8 -5
- data/lib/paper_trail_diff/stored_time_precision.rb +67 -33
- data/lib/paper_trail_diff/stored_values.rb +35 -3
- data/lib/paper_trail_diff/support.rb +185 -35
- data/lib/paper_trail_diff/time_of_day.rb +13 -2
- data/lib/paper_trail_diff/time_range.rb +85 -11
- data/lib/paper_trail_diff/time_version_range.rb +5 -1
- data/lib/paper_trail_diff/timeline_builder.rb +5 -11
- data/lib/paper_trail_diff/timeline_range.rb +56 -19
- data/lib/paper_trail_diff/timeline_snapshot_provider.rb +31 -7
- data/lib/paper_trail_diff/total_order.rb +19 -5
- data/lib/paper_trail_diff/transaction_anchors.rb +138 -0
- data/lib/paper_trail_diff/transaction_cut.rb +67 -327
- data/lib/paper_trail_diff/transaction_ends.rb +194 -0
- data/lib/paper_trail_diff/traversal_preparer.rb +12 -24
- data/lib/paper_trail_diff/{approximate_paths.rb → unreadable_paths.rb} +8 -9
- data/lib/paper_trail_diff/value_objects.rb +8 -6
- data/lib/paper_trail_diff/version.rb +1 -1
- data/lib/paper_trail_diff/version_association_candidate_scope.rb +12 -10
- data/lib/paper_trail_diff/version_boundary.rb +0 -29
- data/lib/paper_trail_diff/version_query.rb +49 -1
- data/lib/paper_trail_diff/version_scope_filter.rb +74 -5
- data/lib/paper_trail_diff/version_sequence_diagnostics.rb +4 -31
- data/lib/paper_trail_diff/version_table.rb +8 -1
- data/lib/paper_trail_diff.rb +56 -110
- data/sig/generated/paper_trail_diff/activity_belongs_to_event_applier.rbs +24 -2
- data/sig/generated/paper_trail_diff/activity_boundary.rbs +6 -0
- data/sig/generated/paper_trail_diff/activity_child_candidate_loader.rbs +46 -5
- data/sig/generated/paper_trail_diff/activity_collection_event_applier.rbs +7 -4
- data/sig/generated/paper_trail_diff/activity_collection_record_updater.rbs +11 -2
- data/sig/generated/paper_trail_diff/activity_collection_route_updater.rbs +8 -6
- data/sig/generated/paper_trail_diff/activity_event.rbs +27 -18
- data/sig/generated/paper_trail_diff/activity_event_record_normalizer.rbs +7 -11
- data/sig/generated/paper_trail_diff/activity_event_record_resolver.rbs +26 -8
- data/sig/generated/paper_trail_diff/activity_event_snapshot_refresher.rbs +10 -2
- data/sig/generated/paper_trail_diff/activity_history.rbs +23 -26
- data/sig/generated/paper_trail_diff/activity_relationship.rbs +0 -6
- data/sig/generated/paper_trail_diff/activity_root_snapshot_refresher.rbs +5 -0
- data/sig/generated/paper_trail_diff/activity_snapshot_sequence.rbs +53 -10
- data/sig/generated/paper_trail_diff/activity_timeline_builder.rbs +64 -38
- data/sig/generated/paper_trail_diff/activity_transaction_applier.rbs +28 -0
- data/sig/generated/paper_trail_diff/activity_tree_filter.rbs +46 -38
- data/sig/generated/paper_trail_diff/activity_tree_places.rbs +45 -0
- data/sig/generated/paper_trail_diff/activity_version_collector.rbs +21 -11
- data/sig/generated/paper_trail_diff/analysis.rbs +6 -5
- data/sig/generated/paper_trail_diff/analysis_batch.rbs +8 -6
- data/sig/generated/paper_trail_diff/association_activity_edge.rbs +58 -45
- data/sig/generated/paper_trail_diff/association_activity_selection.rbs +20 -3
- data/sig/generated/paper_trail_diff/association_discovery.rbs +2 -2
- data/sig/generated/paper_trail_diff/association_key.rbs +2 -11
- data/sig/generated/paper_trail_diff/association_traversal.rbs +43 -44
- data/sig/generated/paper_trail_diff/batch_boundary_resolver.rbs +0 -2
- data/sig/generated/paper_trail_diff/batched_root_analyses.rbs +40 -17
- data/sig/generated/paper_trail_diff/batched_root_analyzer.rbs +2 -2
- data/sig/generated/paper_trail_diff/batched_root_versions.rbs +2 -11
- data/sig/generated/paper_trail_diff/branch_snapshot_refresher.rbs +12 -8
- data/sig/generated/paper_trail_diff/candidate_table.rbs +97 -0
- data/sig/generated/paper_trail_diff/change_attribution.rbs +9 -16
- data/sig/generated/paper_trail_diff/collection_identity_index.rbs +33 -13
- data/sig/generated/paper_trail_diff/collection_transition.rbs +2 -2
- data/sig/generated/paper_trail_diff/comparison_batch.rbs +5 -0
- data/sig/generated/paper_trail_diff/database_time.rbs +48 -0
- data/sig/generated/paper_trail_diff/deleted_analysis_batch.rbs +13 -15
- data/sig/generated/paper_trail_diff/deleted_root_filter.rbs +4 -0
- data/sig/generated/paper_trail_diff/diagnostics.rbs +13 -31
- data/sig/generated/paper_trail_diff/endpoint.rbs +14 -1
- data/sig/generated/paper_trail_diff/errors.rbs +0 -8
- data/sig/generated/paper_trail_diff/exact_column_type.rbs +51 -0
- data/sig/generated/paper_trail_diff/historical_snapshot_store.rbs +51 -31
- data/sig/generated/paper_trail_diff/instrumentation.rbs +0 -5
- data/sig/generated/paper_trail_diff/nested_comparator.rbs +21 -0
- data/sig/generated/paper_trail_diff/paper_trail_adapter.rbs +18 -29
- data/sig/generated/paper_trail_diff/prepared_activity_index.rbs +138 -94
- data/sig/generated/paper_trail_diff/prepared_child_candidates.rbs +10 -2
- data/sig/generated/paper_trail_diff/prepared_edge_loader.rbs +4 -21
- data/sig/generated/paper_trail_diff/prepared_history.rbs +22 -79
- data/sig/generated/paper_trail_diff/prepared_history_loader.rbs +24 -32
- data/sig/generated/paper_trail_diff/prepared_record_index.rbs +137 -63
- data/sig/generated/paper_trail_diff/prepared_snapshot_builder.rbs +22 -13
- data/sig/generated/paper_trail_diff/prepared_state_association_reader.rbs +41 -28
- data/sig/generated/paper_trail_diff/recorded_changes.rbs +19 -3
- data/sig/generated/paper_trail_diff/recorded_owner.rbs +39 -0
- data/sig/generated/paper_trail_diff/root_version_selection.rbs +4 -1
- data/sig/generated/paper_trail_diff/scope_condition.rbs +65 -52
- data/sig/generated/paper_trail_diff/scope_ranking.rbs +10 -23
- data/sig/generated/paper_trail_diff/scoped_analysis.rbs +11 -6
- data/sig/generated/paper_trail_diff/scoped_analysis_builder.rbs +7 -2
- data/sig/generated/paper_trail_diff/scoped_root_selection.rbs +49 -43
- data/sig/generated/paper_trail_diff/selection_window.rbs +19 -0
- data/sig/generated/paper_trail_diff/snapshot.rbs +37 -38
- data/sig/generated/paper_trail_diff/snapshot_members.rbs +58 -0
- data/sig/generated/paper_trail_diff/snapshot_normalizer.rbs +0 -4
- data/sig/generated/paper_trail_diff/stored_form.rbs +63 -0
- data/sig/generated/paper_trail_diff/stored_json_values.rbs +0 -2
- data/sig/generated/paper_trail_diff/stored_time_precision.rbs +33 -20
- data/sig/generated/paper_trail_diff/stored_values.rbs +18 -2
- data/sig/generated/paper_trail_diff/support.rbs +96 -16
- data/sig/generated/paper_trail_diff/time_of_day.rbs +4 -0
- data/sig/generated/paper_trail_diff/time_range.rbs +49 -4
- data/sig/generated/paper_trail_diff/time_version_range.rbs +3 -0
- data/sig/generated/paper_trail_diff/timeline_builder.rbs +3 -6
- data/sig/generated/paper_trail_diff/timeline_range.rbs +29 -8
- data/sig/generated/paper_trail_diff/timeline_snapshot_provider.rbs +17 -4
- data/sig/generated/paper_trail_diff/total_order.rbs +9 -3
- data/sig/generated/paper_trail_diff/transaction_anchors.rbs +80 -0
- data/sig/generated/paper_trail_diff/transaction_cut.rbs +43 -176
- data/sig/generated/paper_trail_diff/transaction_ends.rbs +124 -0
- data/sig/generated/paper_trail_diff/traversal_preparer.rbs +6 -11
- data/sig/generated/paper_trail_diff/{approximate_paths.rbs → unreadable_paths.rbs} +6 -7
- data/sig/generated/paper_trail_diff/value_objects.rbs +4 -2
- data/sig/generated/paper_trail_diff/version_association_candidate_scope.rbs +11 -5
- data/sig/generated/paper_trail_diff/version_boundary.rbs +0 -14
- data/sig/generated/paper_trail_diff/version_query.rbs +26 -0
- data/sig/generated/paper_trail_diff/version_scope_filter.rbs +28 -2
- data/sig/generated/paper_trail_diff/version_sequence_diagnostics.rbs +4 -15
- data/sig/generated/paper_trail_diff/version_table.rbs +4 -0
- data/sig/generated/paper_trail_diff.rbs +22 -23
- metadata +28 -20
- data/lib/paper_trail_diff/activity_target_candidate_loader.rb +0 -123
- data/lib/paper_trail_diff/fallback_paths.rb +0 -35
- data/lib/paper_trail_diff/habtm_transaction_owners.rb +0 -70
- data/lib/paper_trail_diff/historical_association_reifier.rb +0 -161
- data/lib/paper_trail_diff/historical_filter.rb +0 -210
- data/lib/paper_trail_diff/own_window.rb +0 -35
- data/lib/paper_trail_diff/prepared_association_reifier.rb +0 -51
- data/sig/generated/paper_trail_diff/activity_target_candidate_loader.rbs +0 -74
- data/sig/generated/paper_trail_diff/fallback_paths.rbs +0 -22
- data/sig/generated/paper_trail_diff/habtm_transaction_owners.rbs +0 -41
- data/sig/generated/paper_trail_diff/historical_association_reifier.rbs +0 -58
- data/sig/generated/paper_trail_diff/historical_filter.rbs +0 -96
- data/sig/generated/paper_trail_diff/own_window.rbs +0 -22
- data/sig/generated/paper_trail_diff/prepared_association_reifier.rbs +0 -27
|
@@ -10,16 +10,37 @@ module PaperTrailDiff
|
|
|
10
10
|
# and the snapshots read it from there. ActivityTreeFilter leaves out the
|
|
11
11
|
# events of a candidate that was outside the tree throughout.
|
|
12
12
|
class PreparedActivityIndex
|
|
13
|
+
# A belongs_to target an owner's recorded state names. A plain class
|
|
14
|
+
# rather than Data.define, which arrived in Ruby 3.2 while this gem
|
|
15
|
+
# supports 3.1.
|
|
16
|
+
class TargetRow
|
|
17
|
+
attr_reader owner_id: untyped
|
|
18
|
+
|
|
19
|
+
attr_reader foreign_key_id: untyped
|
|
20
|
+
|
|
21
|
+
attr_reader foreign_type: String?
|
|
22
|
+
|
|
23
|
+
# : (untyped, untyped, String?) -> void
|
|
24
|
+
def initialize: (untyped, untyped, String?) -> void
|
|
25
|
+
end
|
|
26
|
+
|
|
13
27
|
# The children the history's owners had, which its edge loader reads
|
|
14
28
|
# first for most of them.
|
|
15
29
|
attr_reader children: PreparedChildCandidates
|
|
16
30
|
|
|
17
|
-
# : (PreparedRecordIndex,
|
|
18
|
-
def initialize: (PreparedRecordIndex,
|
|
31
|
+
# : (PreparedRecordIndex, start_at: untyped) -> void
|
|
32
|
+
def initialize: (PreparedRecordIndex, start_at: untyped) -> void
|
|
33
|
+
|
|
34
|
+
# See PreparedRecordIndex#transaction_ends.
|
|
35
|
+
# : (Array[untyped]) -> TransactionEnds
|
|
36
|
+
def transaction_ends: (Array[untyped]) -> TransactionEnds
|
|
19
37
|
|
|
20
38
|
# : (untyped, Array[untyped]) -> void
|
|
21
39
|
def register: (untyped, Array[untyped]) -> void
|
|
22
40
|
|
|
41
|
+
# A record's events are the versions the history loaded for it, a root of
|
|
42
|
+
# the batch's too: met in another root's tree, its versions after the
|
|
43
|
+
# window are events of that tree as well.
|
|
23
44
|
# : (untyped, Array[untyped]) -> Array[untyped]
|
|
24
45
|
def versions: (untyped, Array[untyped]) -> Array[untyped]
|
|
25
46
|
|
|
@@ -42,6 +63,12 @@ module PaperTrailDiff
|
|
|
42
63
|
# change nothing these `owners` show. As events they would open steps of
|
|
43
64
|
# their own, and inside a transaction, where a change surfaces one event
|
|
44
65
|
# late, take the credit for another record's change.
|
|
66
|
+
#
|
|
67
|
+
# A row of a through that goes through another, such as a member under
|
|
68
|
+
# the member's notes, shows nothing of its path in its own state: it is
|
|
69
|
+
# on it where a row that leads to it does, before its transaction or
|
|
70
|
+
# after it. The groups a through reaches by a `belongs_to` name those
|
|
71
|
+
# rows as `leads`.
|
|
45
72
|
# : (Hash[Symbol, untyped], Hash[Symbol, untyped], untyped) -> Array[untyped]
|
|
46
73
|
def join_versions: (Hash[Symbol, untyped], Hash[Symbol, untyped], untyped) -> Array[untyped]
|
|
47
74
|
|
|
@@ -53,76 +80,44 @@ module PaperTrailDiff
|
|
|
53
80
|
# : (untyped, Array[untyped], untyped, ActivityRange) -> Array[untyped]
|
|
54
81
|
def child_ids: (untyped, Array[untyped], untyped, ActivityRange) -> Array[untyped]
|
|
55
82
|
|
|
56
|
-
# The `belongs_to` targets each owner pointed at
|
|
57
|
-
#
|
|
58
|
-
#
|
|
59
|
-
|
|
83
|
+
# The `belongs_to` targets each owner pointed at, as the states the
|
|
84
|
+
# history holds name them. PT-AT records a version's keys as they stood
|
|
85
|
+
# after its change, which is the state the record's next version stores,
|
|
86
|
+
# or its live row, and the history reads both; it also reads the state a
|
|
87
|
+
# key changed without a version, such as one `has_paper_trail only:`
|
|
88
|
+
# leaves out, reaches only through.
|
|
89
|
+
# : (untyped, Array[untyped], untyped) -> Array[TargetRow]
|
|
90
|
+
def target_rows: (untyped, Array[untyped], untyped) -> Array[TargetRow]
|
|
60
91
|
|
|
61
92
|
# : (untyped, untyped) -> bool
|
|
62
93
|
def loaded?: (untyped, untyped) -> bool
|
|
63
94
|
|
|
64
|
-
# PT-AT records HABTM membership once per transaction, under the
|
|
65
|
-
# association's name, so the rows are keyed by transaction id.
|
|
66
|
-
# : (untyped, Array[untyped], untyped) -> Array[untyped]
|
|
67
|
-
def habtm_rows: (untyped, Array[untyped], untyped) -> Array[untyped]
|
|
68
|
-
|
|
69
95
|
private
|
|
70
96
|
|
|
71
97
|
@conditions: ScopeCondition::Cache
|
|
72
98
|
|
|
99
|
+
@judge: JoinRunJudge
|
|
100
|
+
|
|
73
101
|
@nodes: Hash[String, Array[untyped]]
|
|
74
102
|
|
|
75
103
|
@records: PreparedRecordIndex
|
|
76
104
|
|
|
77
|
-
@roots: Hash[Array[String], Array[untyped]]
|
|
78
|
-
|
|
79
|
-
@rows: Hash[untyped, Hash[String, Array[untyped]]]
|
|
80
|
-
|
|
81
|
-
@start_at: untyped
|
|
82
|
-
|
|
83
|
-
@targets: Hash[untyped, untyped]
|
|
84
|
-
|
|
85
|
-
# The versions one row saved in one transaction, or alone.
|
|
86
|
-
# : (untyped) -> Array[untyped]
|
|
87
|
-
def join_run: (untyped) -> Array[untyped]
|
|
88
|
-
|
|
89
|
-
# A run's versions are in the order they were saved, as the row's series
|
|
90
|
-
# holds them.
|
|
91
|
-
# : (untyped, Array[untyped], ThroughPath) -> bool
|
|
92
|
-
def on_path?: (untyped, Array[untyped], ThroughPath) -> bool
|
|
93
|
-
|
|
94
|
-
# The targets the owners' recorded states point at. PT-AT names a target
|
|
95
|
-
# only in the rows its owner's versions wrote, so a key changed without a
|
|
96
|
-
# version, such as one `has_paper_trail only:` leaves out, names its target
|
|
97
|
-
# only in the state the owner's next version recorded. Prepared history
|
|
98
|
-
# reads that state, so its snapshots show the target, and the target's
|
|
99
|
-
# versions are events too. A key of two columns is read per record instead.
|
|
100
|
-
# : (untyped, Array[untyped], untyped) -> Array[ActivityTargetCandidateLoader::Row]
|
|
101
|
-
def recorded_target_rows: (untyped, Array[untyped], untyped) -> Array[ActivityTargetCandidateLoader::Row]
|
|
102
|
-
|
|
103
105
|
# : (untyped, Array[untyped]) -> bool
|
|
104
106
|
def member_class?: (untyped, Array[untyped]) -> bool
|
|
105
107
|
|
|
106
108
|
# : (untyped, Array[untyped], untyped, ActivityRange) -> Array[untyped]
|
|
107
109
|
def historical_ids: (untyped, Array[untyped], untyped, ActivityRange) -> Array[untyped]
|
|
108
110
|
|
|
111
|
+
# The records of a model the history holds, which every owner whose
|
|
112
|
+
# children are asked for is among.
|
|
109
113
|
# : (untyped) -> Array[untyped]
|
|
110
114
|
def node_ids: (untyped) -> Array[untyped]
|
|
111
115
|
|
|
112
|
-
# : (Hash[String, Array[ActivityTargetCandidateLoader::Row]], Array[untyped]) -> Array[ActivityTargetCandidateLoader::Row]
|
|
113
|
-
def rows_for: (Hash[String, Array[ActivityTargetCandidateLoader::Row]], Array[untyped]) -> Array[ActivityTargetCandidateLoader::Row]
|
|
114
|
-
|
|
115
|
-
# : (untyped, Array[ActivityTargetCandidateLoader::Row], ActivityRange) -> Array[ActivityTargetCandidateLoader::Row]
|
|
116
|
-
def eligible_rows: (untyped, Array[ActivityTargetCandidateLoader::Row], ActivityRange) -> Array[ActivityTargetCandidateLoader::Row]
|
|
117
|
-
|
|
118
|
-
# : (untyped, untyped) -> untyped
|
|
119
|
-
def target_candidates: (untyped, untyped) -> untyped
|
|
120
|
-
|
|
121
116
|
# Mirrors VersionAssociationCandidateScope's before-window rule. The loaded
|
|
122
117
|
# series includes changes to other owners too, so an old membership cannot
|
|
123
118
|
# survive a later pre-window reassignment just because that owner is absent.
|
|
124
119
|
# A range starting at a version starts before that version's transaction,
|
|
125
|
-
# as the scope's start does (see
|
|
120
|
+
# as the scope's start does (see TransactionCut.range_start), so a
|
|
126
121
|
# membership that ended earlier in that transaction still held there. So
|
|
127
122
|
# did one that the record's own transaction across the start ended.
|
|
128
123
|
# : (untyped, untyped, untyped, String?, ActivityRange) -> bool
|
|
@@ -134,72 +129,121 @@ module PaperTrailDiff
|
|
|
134
129
|
def replaced_after_start?: (Array[untyped], Integer, ActivityRange) -> bool
|
|
135
130
|
|
|
136
131
|
# Whether every version of a record from `first` up to the start is one
|
|
137
|
-
# of
|
|
132
|
+
# of a transaction that crossed the start: one the record saved a version
|
|
133
|
+
# in from the start onward, or one the history found crossing it by
|
|
134
|
+
# another record's versions. Such a transaction may have saved this
|
|
135
|
+
# record only before the start, as when it moved a comment away there
|
|
136
|
+
# and saved the comment's reply after it. The window before the start
|
|
137
|
+
# leaves that move to this one, which finds the reply only under the
|
|
138
|
+
# comment where it stood before the transaction.
|
|
138
139
|
# : (Array[untyped], Integer, untyped) -> bool
|
|
139
140
|
def crossed_start?: (Array[untyped], Integer, untyped) -> bool
|
|
141
|
+
end
|
|
140
142
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
143
|
+
# Whether one state of a through's join row puts it on the through's path.
|
|
144
|
+
# The row must join one of the owners as the join association reads it: by
|
|
145
|
+
# its key, by the owner's type under `as:`, by its class when the
|
|
146
|
+
# association is to a subclass, and by the association's scope when the
|
|
147
|
+
# gem can read it, unranked, as a through reads its parts. A through that
|
|
148
|
+
# goes through a belongs_to, or through another through, is joined by the
|
|
149
|
+
# owner's key or by rows further down, which a row's own state cannot
|
|
150
|
+
# show. Under `source_type:`, the row's type column must name that class;
|
|
151
|
+
# a version saved before the column existed has no type to read.
|
|
152
|
+
class ThroughPath
|
|
153
|
+
# : (Hash[Symbol, untyped], untyped, ScopeCondition::Cache) -> void
|
|
154
|
+
def initialize: (Hash[Symbol, untyped], untyped, ScopeCondition::Cache) -> void
|
|
155
|
+
|
|
156
|
+
# Whether every state of a row is on the path, so that none need be read.
|
|
157
|
+
# : () -> bool
|
|
158
|
+
def open?: () -> bool
|
|
159
|
+
|
|
160
|
+
# : (Hash[untyped, untyped]) -> bool
|
|
161
|
+
def include?: (Hash[untyped, untyped]) -> bool
|
|
144
162
|
|
|
145
|
-
|
|
146
|
-
# : (Array[untyped]) -> Array[untyped]
|
|
147
|
-
def transaction_ids: (Array[untyped]) -> Array[untyped]
|
|
163
|
+
private
|
|
148
164
|
|
|
149
|
-
|
|
150
|
-
# The row must join one of the owners as the join association reads it: by
|
|
151
|
-
# its key, by the owner's type under `as:`, by its class when the
|
|
152
|
-
# association is to a subclass, and by the association's scope when the
|
|
153
|
-
# gem can read it, unranked, as a through reads its parts. A through that
|
|
154
|
-
# goes through a belongs_to, or through another through, is joined by the
|
|
155
|
-
# owner's key or by rows further down, which a row's own state cannot
|
|
156
|
-
# show. Under `source_type:`, the row's type column must name that class;
|
|
157
|
-
# a version saved before the column existed has no type to read.
|
|
158
|
-
class ThroughPath
|
|
159
|
-
# : (Hash[Symbol, untyped], untyped, ScopeCondition::Cache) -> void
|
|
160
|
-
def initialize: (Hash[Symbol, untyped], untyped, ScopeCondition::Cache) -> void
|
|
165
|
+
@conditions: ScopeCondition::Cache
|
|
161
166
|
|
|
162
|
-
|
|
163
|
-
# : () -> bool
|
|
164
|
-
def open?: () -> bool
|
|
167
|
+
@ids: Set[String]
|
|
165
168
|
|
|
166
|
-
|
|
167
|
-
def include?: (Hash[untyped, untyped]) -> bool
|
|
169
|
+
@keyed: bool
|
|
168
170
|
|
|
169
|
-
|
|
171
|
+
@owner_type: String?
|
|
170
172
|
|
|
171
|
-
|
|
173
|
+
@reflection: untyped
|
|
172
174
|
|
|
173
|
-
|
|
175
|
+
@through: untyped
|
|
174
176
|
|
|
175
|
-
|
|
177
|
+
# : () -> bool
|
|
178
|
+
def keyed?: () -> bool
|
|
176
179
|
|
|
177
|
-
|
|
180
|
+
# : (Hash[untyped, untyped]) -> bool
|
|
181
|
+
def joined?: (Hash[untyped, untyped]) -> bool
|
|
178
182
|
|
|
179
|
-
|
|
183
|
+
# An `as:` row's type column must hold its owner's polymorphic name.
|
|
184
|
+
# : (Hash[untyped, untyped]) -> bool
|
|
185
|
+
def owner_type?: (Hash[untyped, untyped]) -> bool
|
|
180
186
|
|
|
181
|
-
|
|
187
|
+
# : (Hash[untyped, untyped]) -> bool
|
|
188
|
+
def in_scope?: (Hash[untyped, untyped]) -> bool
|
|
182
189
|
|
|
183
|
-
|
|
184
|
-
|
|
190
|
+
# As the through's snapshots read a join row (see
|
|
191
|
+
# PreparedStateAssociationReader#typed_join?).
|
|
192
|
+
# : (Hash[untyped, untyped]) -> bool
|
|
193
|
+
def typed?: (Hash[untyped, untyped]) -> bool
|
|
194
|
+
end
|
|
185
195
|
|
|
186
|
-
|
|
187
|
-
|
|
196
|
+
# How the versions of a through's join row are judged (see
|
|
197
|
+
# PreparedActivityIndex#join_versions): by the row's own states, or by the
|
|
198
|
+
# rows that lead to it, or not at all. A version is judged by its whole
|
|
199
|
+
# transaction, so the row's versions in one transaction are judged alike.
|
|
200
|
+
class JoinRunJudge
|
|
201
|
+
# : (PreparedRecordIndex, ScopeCondition::Cache) -> void
|
|
202
|
+
def initialize: (PreparedRecordIndex, ScopeCondition::Cache) -> void
|
|
188
203
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
def owner_types: (untyped) -> Array[String]?
|
|
204
|
+
# : (Hash[Symbol, untyped], Hash[Symbol, untyped], untyped) -> (^(untyped) -> bool)?
|
|
205
|
+
def call: (Hash[Symbol, untyped], Hash[Symbol, untyped], untyped) -> (^(untyped) -> bool)?
|
|
192
206
|
|
|
193
|
-
|
|
194
|
-
def owner_type?: (Hash[untyped, untyped]) -> bool
|
|
207
|
+
private
|
|
195
208
|
|
|
196
|
-
|
|
197
|
-
def in_scope?: (Hash[untyped, untyped]) -> bool
|
|
209
|
+
@conditions: ScopeCondition::Cache
|
|
198
210
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
211
|
+
@records: PreparedRecordIndex
|
|
212
|
+
|
|
213
|
+
# : (untyped, untyped, ThroughPath) -> bool
|
|
214
|
+
def on_path?: (untyped, untyped, ThroughPath) -> bool
|
|
215
|
+
|
|
216
|
+
# The first and last versions the row saved in the version's
|
|
217
|
+
# transaction: a version is judged by the row's whole transaction, not
|
|
218
|
+
# only the part inside the range. A window whose edge falls inside the transaction holds only
|
|
219
|
+
# some of the row's versions in it. Judged by its destroy alone, a row
|
|
220
|
+
# moved here and destroyed in one transaction was on the path, so the
|
|
221
|
+
# window after the edge reported the transaction, which the window before
|
|
222
|
+
# it, judging the row by both versions, reported too. The row's series
|
|
223
|
+
# holds the whole transaction: history crossed by one is read from where
|
|
224
|
+
# it began (see PreparedHistoryLoader#reload). A version saved outside a
|
|
225
|
+
# transaction is judged alone.
|
|
226
|
+
# : (untyped, untyped) -> [untyped, untyped]
|
|
227
|
+
def transaction_span: (untyped, untyped) -> [ untyped, untyped ]
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
# Whether the rows that lead to a through's target, as a through over that
|
|
231
|
+
# through reads it, named the target before a transaction of the target's
|
|
232
|
+
# or after it, on their own path (see PreparedActivityIndex#join_versions).
|
|
233
|
+
class ThroughLead
|
|
234
|
+
# : (PreparedRecordIndex, Hash[Symbol, untyped], Hash[Symbol, untyped], ScopeCondition::Cache) -> void
|
|
235
|
+
def initialize: (PreparedRecordIndex, Hash[Symbol, untyped], Hash[Symbol, untyped], ScopeCondition::Cache) -> void
|
|
236
|
+
|
|
237
|
+
# `first` and `last` are the target's versions that span its transaction.
|
|
238
|
+
# : (untyped, untyped) -> bool
|
|
239
|
+
def include?: (untyped, untyped) -> bool
|
|
240
|
+
|
|
241
|
+
@key: untyped
|
|
242
|
+
|
|
243
|
+
@path: ThroughPath
|
|
244
|
+
|
|
245
|
+
@records: PreparedRecordIndex
|
|
246
|
+
|
|
247
|
+
@rows: Hash[Symbol, untyped]
|
|
204
248
|
end
|
|
205
249
|
end
|
|
@@ -23,8 +23,9 @@ module PaperTrailDiff
|
|
|
23
23
|
def add: (Array[untyped], ActivityChildCandidateLoader) -> void
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
#
|
|
27
|
-
|
|
26
|
+
# `end_at` is where the history ends, if it does.
|
|
27
|
+
# : (untyped, ?untyped) -> void
|
|
28
|
+
def initialize: (untyped, ?untyped) -> void
|
|
28
29
|
|
|
29
30
|
# The owners not read yet are read together, with the others the block
|
|
30
31
|
# names, so that owners asked about later need none. Each owner class
|
|
@@ -32,6 +33,13 @@ module PaperTrailDiff
|
|
|
32
33
|
# : (untyped, Array[untyped], untyped) ?{ () -> Array[untyped] } -> [Hash[String, Array[Array[untyped]]], Hash[String, Array[untyped]]]
|
|
33
34
|
def call: (untyped, Array[untyped], untyped) ?{ () -> Array[untyped] } -> [ Hash[String, Array[Array[untyped]]], Hash[String, Array[untyped]] ]
|
|
34
35
|
|
|
36
|
+
private
|
|
37
|
+
|
|
38
|
+
# : (untyped, Array[untyped], untyped) -> ActivityChildCandidateLoader
|
|
39
|
+
def loader: (untyped, Array[untyped], untyped) -> ActivityChildCandidateLoader
|
|
40
|
+
|
|
41
|
+
@end_at: untyped
|
|
42
|
+
|
|
35
43
|
@read: Hash[Array[untyped], Read]
|
|
36
44
|
|
|
37
45
|
@start_at: untyped
|
|
@@ -5,12 +5,11 @@ module PaperTrailDiff
|
|
|
5
5
|
class PreparedEdgeLoader
|
|
6
6
|
# A history shares `children` with its activity index, which reads the
|
|
7
7
|
# children this finds again.
|
|
8
|
-
# : (PreparedRecordIndex,
|
|
9
|
-
def initialize: (PreparedRecordIndex,
|
|
8
|
+
# : (PreparedRecordIndex, children: PreparedChildCandidates) -> void
|
|
9
|
+
def initialize: (PreparedRecordIndex, children: PreparedChildCandidates) -> void
|
|
10
10
|
|
|
11
|
-
#
|
|
12
|
-
|
|
13
|
-
def call: (untyped, Array[untyped], untyped) -> [ Hash[String, Hash[Symbol, untyped]], Hash[String, Array[untyped]]? ]
|
|
11
|
+
# : (untyped, Array[untyped], untyped) -> Hash[String, Hash[Symbol, untyped]]
|
|
12
|
+
def call: (untyped, Array[untyped], untyped) -> Hash[String, Hash[Symbol, untyped]]
|
|
14
13
|
|
|
15
14
|
private
|
|
16
15
|
|
|
@@ -18,8 +17,6 @@ module PaperTrailDiff
|
|
|
18
17
|
|
|
19
18
|
@records: PreparedRecordIndex
|
|
20
19
|
|
|
21
|
-
@transaction_ids: Array[untyped]
|
|
22
|
-
|
|
23
20
|
# : (untyped, Array[untyped], untyped) -> Hash[String, Hash[Symbol, untyped]]
|
|
24
21
|
def belongs_to_groups: (untyped, Array[untyped], untyped) -> Hash[String, Hash[Symbol, untyped]]
|
|
25
22
|
|
|
@@ -32,20 +29,6 @@ module PaperTrailDiff
|
|
|
32
29
|
# : (untyped, Array[untyped], untyped) -> Hash[String, Hash[Symbol, untyped]]
|
|
33
30
|
def child_groups: (untyped, Array[untyped], untyped) -> Hash[String, Hash[Symbol, untyped]]
|
|
34
31
|
|
|
35
|
-
# A transaction more than one owner recorded members in is left out, so
|
|
36
|
-
# its read falls back to HistoricalAssociationReifier, which raises.
|
|
37
|
-
# : (untyped, untyped) -> [Hash[String, Hash[Symbol, untyped]], Hash[String, Array[untyped]]]
|
|
38
|
-
def habtm_groups: (untyped, untyped) -> [ Hash[String, Hash[Symbol, untyped]], Hash[String, Array[untyped]] ]
|
|
39
|
-
|
|
40
|
-
# Each root transaction's members, from its rows grouped by transaction.
|
|
41
|
-
# : (Hash[String, Array[untyped]]) -> Hash[String, Array[untyped]]
|
|
42
|
-
def memberships: (Hash[String, Array[untyped]]) -> Hash[String, Array[untyped]]
|
|
43
|
-
|
|
44
|
-
# Each statement reads up to 500 of the root transactions: SQL Server
|
|
45
|
-
# compiles a long list of ids slowly.
|
|
46
|
-
# : (untyped, untyped) -> Array[untyped]
|
|
47
|
-
def habtm_rows: (untyped, untyped) -> Array[untyped]
|
|
48
|
-
|
|
49
32
|
# : (Hash[String, Hash[Symbol, untyped]], untyped, untyped) -> void
|
|
50
33
|
def add_identity: (Hash[String, Hash[Symbol, untyped]], untyped, untyped) -> void
|
|
51
34
|
|
|
@@ -5,17 +5,27 @@ module PaperTrailDiff
|
|
|
5
5
|
class PreparedHistory
|
|
6
6
|
attr_reader activity_index: PreparedActivityIndex?
|
|
7
7
|
|
|
8
|
-
#
|
|
9
|
-
|
|
10
|
-
# PreparedHistoryLoader#reload.
|
|
11
|
-
attr_reader opening_transactions: Array[Array[untyped]]
|
|
8
|
+
# : (PreparedRecordIndex, ?activity_index: PreparedActivityIndex?) -> void
|
|
9
|
+
def initialize: (PreparedRecordIndex, ?activity_index: PreparedActivityIndex?) -> void
|
|
12
10
|
|
|
13
|
-
#
|
|
14
|
-
|
|
11
|
+
# When the history was read from.
|
|
12
|
+
# : () -> untyped
|
|
13
|
+
def start_time: () -> untyped
|
|
15
14
|
|
|
16
15
|
# : () -> Array[untyped]
|
|
17
16
|
def versions: () -> Array[untyped]
|
|
18
17
|
|
|
18
|
+
# See PreparedRecordIndex#reading.
|
|
19
|
+
# : (TransactionEnds) { () -> void } -> void
|
|
20
|
+
def reading: (TransactionEnds) { () -> void } -> void
|
|
21
|
+
|
|
22
|
+
# See PreparedRecordIndex#transaction_ends.
|
|
23
|
+
# : (Array[untyped]) -> TransactionEnds
|
|
24
|
+
def transaction_ends: (Array[untyped]) -> TransactionEnds
|
|
25
|
+
|
|
26
|
+
# : () -> TransactionEnds?
|
|
27
|
+
def reading_ends: () -> TransactionEnds?
|
|
28
|
+
|
|
19
29
|
# Returns every group the edge now holds.
|
|
20
30
|
# : (untyped, untyped, Hash[String, Hash[Symbol, untyped]]) -> Hash[String, Hash[Symbol, untyped]]
|
|
21
31
|
def merge_edge: (untyped, untyped, Hash[String, Hash[Symbol, untyped]]) -> Hash[String, Hash[Symbol, untyped]]
|
|
@@ -23,92 +33,25 @@ module PaperTrailDiff
|
|
|
23
33
|
# : (untyped, untyped) -> Hash[String, Hash[Symbol, untyped]]
|
|
24
34
|
def edge: (untyped, untyped) -> Hash[String, Hash[Symbol, untyped]]
|
|
25
35
|
|
|
26
|
-
# : (untyped, untyped) -> void
|
|
27
|
-
def mark_unsupported: (untyped, untyped) -> void
|
|
28
|
-
|
|
29
|
-
# : (untyped, untyped, Hash[String, Array[untyped]]) -> void
|
|
30
|
-
def register_habtm: (untyped, untyped, Hash[String, Array[untyped]]) -> void
|
|
31
|
-
|
|
32
36
|
# : (untyped, untyped, untyped) -> [Hash[untyped, untyped], Hash[untyped, untyped]]?
|
|
33
37
|
def record_transition: (untyped, untyped, untyped) -> [ Hash[untyped, untyped], Hash[untyped, untyped] ]?
|
|
34
38
|
|
|
35
|
-
# : (untyped, untyped, untyped
|
|
36
|
-
def record_after: (untyped, untyped, untyped
|
|
37
|
-
|
|
38
|
-
# : (PreparedRecordState, untyped, untyped) -> [bool, Array[PreparedRecordState]]
|
|
39
|
-
def snapshot_states: (PreparedRecordState, untyped, untyped) -> [ bool, Array[PreparedRecordState] ]
|
|
39
|
+
# : (untyped, untyped, untyped) -> [bool, PreparedRecordState?]
|
|
40
|
+
def record_after: (untyped, untyped, untyped) -> [ bool, PreparedRecordState? ]
|
|
40
41
|
|
|
41
|
-
#
|
|
42
|
-
#
|
|
43
|
-
# : (
|
|
44
|
-
def
|
|
42
|
+
# Who was in the owner's association at the boundary (see
|
|
43
|
+
# PreparedStateAssociationReader).
|
|
44
|
+
# : (PreparedRecordState, untyped, untyped) -> Array[PreparedRecordState]
|
|
45
|
+
def snapshot_states: (PreparedRecordState, untyped, untyped) -> Array[PreparedRecordState]
|
|
45
46
|
|
|
46
47
|
private
|
|
47
48
|
|
|
48
|
-
@conditions: ScopeCondition::Cache
|
|
49
|
-
|
|
50
49
|
@edges: Hash[Array[String], Hash[String, Hash[Symbol, untyped]]]
|
|
51
50
|
|
|
52
|
-
@habtm: Hash[Array[String], Hash[String, Array[untyped]]]
|
|
53
|
-
|
|
54
51
|
@records: PreparedRecordIndex
|
|
55
52
|
|
|
56
53
|
@state_reader: PreparedStateAssociationReader
|
|
57
54
|
|
|
58
|
-
@unsupported: Hash[Array[String], bool]
|
|
59
|
-
|
|
60
|
-
# A polymorphic target's class is known only once a record names it, so
|
|
61
|
-
# belongs_to_records reads its scope for each record instead.
|
|
62
|
-
# : (untyped, untyped, bool) -> bool
|
|
63
|
-
def supported?: (untyped, untyped, bool) -> bool
|
|
64
|
-
|
|
65
|
-
# : (untyped, untyped, untyped, untyped, bool) -> Array[untyped]?
|
|
66
|
-
def direct_records: (untyped, untyped, untyped, untyped, bool) -> Array[untyped]?
|
|
67
|
-
|
|
68
|
-
# : (untyped, untyped, untyped, bool) -> Array[untyped]?
|
|
69
|
-
def belongs_to_records: (untyped, untyped, untyped, bool) -> Array[untyped]?
|
|
70
|
-
|
|
71
|
-
# : (untyped, untyped, untyped, bool) -> Array[untyped]
|
|
72
|
-
def child_records: (untyped, untyped, untyped, bool) -> Array[untyped]
|
|
73
|
-
|
|
74
|
-
# : (Hash[Symbol, untyped], untyped) -> Array[untyped]
|
|
75
|
-
def child_ids_for: (Hash[Symbol, untyped], untyped) -> Array[untyped]
|
|
76
|
-
|
|
77
|
-
# PT-AT records a checkpoint's membership as it is when the checkpoint is
|
|
78
|
-
# saved, so a tag attached earlier in the checkpoint's own transaction is a
|
|
79
|
-
# member there, unlike other associations, which a version reads as they
|
|
80
|
-
# were before its transaction. A member created in that transaction has no
|
|
81
|
-
# earlier state, so it is read as it was created, from its creation on.
|
|
82
|
-
# The checkpoint's membership also stands for earlier points, since the
|
|
83
|
-
# previous root version; the member did not exist at those yet.
|
|
84
|
-
# : (untyped, untyped, untyped, untyped, bool) -> Array[untyped]?
|
|
85
|
-
def habtm_records: (untyped, untyped, untyped, untyped, bool) -> Array[untyped]?
|
|
86
|
-
|
|
87
|
-
# : (untyped, untyped, untyped, bool) -> untyped
|
|
88
|
-
def habtm_member: (untyped, untyped, untyped, bool) -> untyped
|
|
89
|
-
|
|
90
|
-
# A has_many through reads its parts unranked, as its query does. Its own
|
|
91
|
-
# scope applies to each row, and a ranked read then keeps a record reached
|
|
92
|
-
# twice as one member.
|
|
93
|
-
# : (untyped, untyped, untyped, untyped, bool) -> Array[untyped]?
|
|
94
|
-
def through_records: (untyped, untyped, untyped, untyped, bool) -> Array[untyped]?
|
|
95
|
-
|
|
96
|
-
# The source records of each join record, once for each join.
|
|
97
|
-
# : (untyped, untyped, ^(untyped, untyped) -> [bool, Array[untyped]]) -> Array[untyped]?
|
|
98
|
-
def through_rows: (untyped, untyped, ^(untyped, untyped) -> [ bool, Array[untyped] ]) -> Array[untyped]?
|
|
99
|
-
|
|
100
|
-
# : (untyped, untyped, untyped) -> bool
|
|
101
|
-
def member_of?: (untyped, untyped, untyped) -> bool
|
|
102
|
-
|
|
103
|
-
# : (untyped, untyped) -> Array[String]
|
|
104
|
-
def owner_types: (untyped, untyped) -> Array[String]
|
|
105
|
-
|
|
106
|
-
# : (untyped) -> untyped
|
|
107
|
-
def transaction_id_for: (untyped) -> untyped
|
|
108
|
-
|
|
109
|
-
# : (Array[untyped]) -> Array[untyped]
|
|
110
|
-
def unique_records: (Array[untyped]) -> Array[untyped]
|
|
111
|
-
|
|
112
55
|
# : (untyped, untyped) -> Array[String]
|
|
113
56
|
def edge_key: (untyped, untyped) -> Array[String]
|
|
114
57
|
end
|
|
@@ -5,10 +5,24 @@ module PaperTrailDiff
|
|
|
5
5
|
class PreparedHistoryLoader
|
|
6
6
|
# Without `end_at`, the activity range closes on the last root version.
|
|
7
7
|
# A `window` is a time range; a range of versions starts at the state its
|
|
8
|
-
# first version names.
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
|
|
8
|
+
# first version names.
|
|
9
|
+
#
|
|
10
|
+
# A transaction takes effect where it saved its last version (see
|
|
11
|
+
# TransactionEnds), so one that crosses a window's start is reported in
|
|
12
|
+
# the window, with what it saved before the start, and one that crosses
|
|
13
|
+
# the end in a later window. A history read from the window's start holds
|
|
14
|
+
# neither the versions the first saved before it, nor the records only
|
|
15
|
+
# those versions name, such as one it destroyed there. So a window is
|
|
16
|
+
# read from where the earliest of them began, its `reach`, which its
|
|
17
|
+
# reader asks before reading (see AssociationTraversal#reach_before).
|
|
18
|
+
# Where the second ends is read from its version table, so nothing past
|
|
19
|
+
# the window's end is.
|
|
20
|
+
#
|
|
21
|
+
# A range of versions reads the same way from its first version's
|
|
22
|
+
# transaction (see TransactionCut), and from where a transaction open
|
|
23
|
+
# there began (`crossing`).
|
|
24
|
+
# : (untyped, root_ids: Array[untyped], root_versions: Array[untyped], tree: AssociationTree, traversal: AssociationTraversal, start_at: untyped, end_at: untyped, live_records: Array[untyped], window: bool) -> void
|
|
25
|
+
def initialize: (untyped, root_ids: Array[untyped], root_versions: Array[untyped], tree: AssociationTree, traversal: AssociationTraversal, start_at: untyped, end_at: untyped, live_records: Array[untyped], window: bool) -> void
|
|
12
26
|
|
|
13
27
|
# : () -> PreparedHistory
|
|
14
28
|
def call: () -> PreparedHistory
|
|
@@ -19,12 +33,8 @@ module PaperTrailDiff
|
|
|
19
33
|
|
|
20
34
|
@edges: PreparedEdgeLoader
|
|
21
35
|
|
|
22
|
-
@end_at: untyped
|
|
23
|
-
|
|
24
36
|
@history: PreparedHistory
|
|
25
37
|
|
|
26
|
-
@live_records: Array[untyped]
|
|
27
|
-
|
|
28
38
|
@prepared: Hash[untyped, Set[String]]
|
|
29
39
|
|
|
30
40
|
@record: untyped
|
|
@@ -33,30 +43,10 @@ module PaperTrailDiff
|
|
|
33
43
|
|
|
34
44
|
@root_ids: Array[untyped]
|
|
35
45
|
|
|
36
|
-
@root_versions: Array[untyped]
|
|
37
|
-
|
|
38
46
|
@traversal: AssociationTraversal
|
|
39
47
|
|
|
40
48
|
@tree: AssociationTree
|
|
41
49
|
|
|
42
|
-
@window: bool
|
|
43
|
-
|
|
44
|
-
# A transaction that crosses a window's start and saved a version of the
|
|
45
|
-
# root moves the window's edge back to where it began (see
|
|
46
|
-
# TransactionCut); one that saved only associated records moves nothing.
|
|
47
|
-
# A boundary in such a transaction still reads each record as it stood
|
|
48
|
-
# before the transaction began (see PreparedRecordSeries#boundary_index),
|
|
49
|
-
# and a history read from the window's start holds neither the versions
|
|
50
|
-
# it saved before the start nor the records only those versions name, such
|
|
51
|
-
# as one it destroyed there. Without them the window would start after
|
|
52
|
-
# changes that the window before it left to this one, by ending its step
|
|
53
|
-
# at one of the transaction's events here (see ActivityTreeFilter), and
|
|
54
|
-
# neither would report them. So the history is read again from where the
|
|
55
|
-
# earliest such transaction began; the window's events still start at its
|
|
56
|
-
# start.
|
|
57
|
-
# : (Array[Array[untyped]], untyped) -> PreparedHistory
|
|
58
|
-
def reload: (Array[Array[untyped]], untyped) -> PreparedHistory
|
|
59
|
-
|
|
60
50
|
# : (untyped, Array[untyped], AssociationTree, path: String) -> void
|
|
61
51
|
def load_node: (untyped, Array[untyped], AssociationTree, path: String) -> void
|
|
62
52
|
|
|
@@ -65,10 +55,15 @@ module PaperTrailDiff
|
|
|
65
55
|
|
|
66
56
|
# Either part can itself be a through, which has no key of its own to
|
|
67
57
|
# read, so each part is prepared as what it is. Like an edge, it returns
|
|
68
|
-
# every group it holds, not only those of these owners.
|
|
58
|
+
# every group it holds, not only those of these owners. Under
|
|
59
|
+
# `source_type:`, only targets of that type are members, so the path
|
|
60
|
+
# descends into no other.
|
|
69
61
|
# : (untyped, Array[untyped], untyped) -> Hash[String, Hash[Symbol, untyped]]
|
|
70
62
|
def prepare_through: (untyped, Array[untyped], untyped) -> Hash[String, Hash[Symbol, untyped]]
|
|
71
63
|
|
|
64
|
+
# : (untyped, Hash[String, Hash[Symbol, untyped]]) -> Hash[String, Hash[Symbol, untyped]]
|
|
65
|
+
def of_source_type: (untyped, Hash[String, Hash[Symbol, untyped]]) -> Hash[String, Hash[Symbol, untyped]]
|
|
66
|
+
|
|
72
67
|
# : (untyped, Array[untyped], untyped) -> Hash[String, Hash[Symbol, untyped]]
|
|
73
68
|
def prepare_edge: (untyped, Array[untyped], untyped) -> Hash[String, Hash[Symbol, untyped]]
|
|
74
69
|
|
|
@@ -80,9 +75,6 @@ module PaperTrailDiff
|
|
|
80
75
|
# : (Array[untyped], untyped) -> void
|
|
81
76
|
def mark_prepared: (Array[untyped], untyped) -> void
|
|
82
77
|
|
|
83
|
-
# : (untyped, untyped, Hash[String, Hash[Symbol, untyped]]) -> void
|
|
84
|
-
def mark_unsupported: (untyped, untyped, Hash[String, Hash[Symbol, untyped]]) -> void
|
|
85
|
-
|
|
86
78
|
# : (Hash[String, Hash[Symbol, untyped]]) -> void
|
|
87
79
|
def load_groups: (Hash[String, Hash[Symbol, untyped]]) -> void
|
|
88
80
|
|