Skip to content

Geo: PoC Replicators

What does this MR do?

Few improvements on @mkozono PoC for the self-service framework (!20672 (closed)) related to #35540 (closed).

My goal here is to have a centralized place where we describe the observed component that will have an "event" replicated.

Progress:

  • Replicator class and app folder structure
  • Event DSL inside replicator
  • "Publish" interface
  • Refactor existing code to use a replicator and the new "Publish" interface
  • Merge multiple EventStore classes into publish_eventname on replicator
  • Model DSL to associate a replicator and inject useful methods in it

Usage draft


class Project < ActiveRecord::Base
  include Gitlab::Geo::Replicator::ModelIntegration

  with_geo_replicator ProjectReplicator

  after_save ->(model) { replicator.publish :created }
  after_destroy ->(model) { replicator.publish :deleted }
end
Edited by Gabriel Mazetto

Merge request reports