Class: LogStash::Filters::ElasticIntegration::GeoipDatabaseProviderBridge::ObservingDatabaseHolder
- Inherits:
-
ManagedIpDatabaseHolder
- Object
- ManagedIpDatabaseHolder
- LogStash::Filters::ElasticIntegration::GeoipDatabaseProviderBridge::ObservingDatabaseHolder
- Defined in:
- lib/logstash/filters/elastic_integration/geoip_database_provider_bridge.rb
Instance Method Summary collapse
- #close ⇒ Object
- #construct(db_info) ⇒ Object
-
#initialize(simple_database_type, eula_manager:, logger: nil) ⇒ ObservingDatabaseHolder
constructor
A new instance of ObservingDatabaseHolder.
- #on_expire ⇒ Object
- #on_update(db_info) ⇒ Object
Constructor Details
#initialize(simple_database_type, eula_manager:, logger: nil) ⇒ ObservingDatabaseHolder
Returns a new instance of ObservingDatabaseHolder.
58 59 60 61 62 63 64 65 66 |
# File 'lib/logstash/filters/elastic_integration/geoip_database_provider_bridge.rb', line 58 def initialize(simple_database_type, eula_manager:, logger: nil) super("GeoLite2-#{simple_database_type}") @simple_database_type = simple_database_type @logger = logger @subscription = eula_manager.subscribe_database_path(simple_database_type) @subscription.observe(self) end |
Instance Method Details
#close ⇒ Object
83 84 85 86 87 |
# File 'lib/logstash/filters/elastic_integration/geoip_database_provider_bridge.rb', line 83 def close super ensure @subscription&.release! end |
#construct(db_info) ⇒ Object
68 69 70 71 |
# File 'lib/logstash/filters/elastic_integration/geoip_database_provider_bridge.rb', line 68 def construct(db_info) @logger&.debug("CONSTRUCT[#{@simple_database_type} => #{db_info}]") self.setDatabasePath(db_info.path) end |
#on_expire ⇒ Object
78 79 80 81 |
# File 'lib/logstash/filters/elastic_integration/geoip_database_provider_bridge.rb', line 78 def on_expire() @logger&.debug("ON_EXPIRE[#{@simple_database_type}]") self.setDatabasePath(nil) end |
#on_update(db_info) ⇒ Object
73 74 75 76 |
# File 'lib/logstash/filters/elastic_integration/geoip_database_provider_bridge.rb', line 73 def on_update(db_info) @logger&.debug("ON_UPDATE[#{@simple_database_type} => #{db_info}]") self.setDatabasePath(db_info.path) end |