Skip to content

StorageProxyFactory Abstraction

Kevin Yan edited this page Mar 22, 2021 · 4 revisions

Purpose

The StorageProxyFactory is used to abstract out implementation that is storage-engine-specific. Ideally, the code would not need to know which storage engine the user wants to use. Instead, it would make calls to the StorageProxyFactory that would return the appropriate parameters and implementation based on the storage engine specified in the config file (look here for more on the config file).

Structure

All files for the StorageProxyFactory Abstraction are located in the storage directory. NOTE: Elasticsearch counterparts are coming in a future pull request.

StorageProxyFactory.scala
StorageProxy.scala
solr/
  SolrProxy.scala
elasticsearch/
  ElasticsearchProxy.scala

From bottom-up, each storage engine has a *Proxy.scala (ex: SolrProxy.scala). This proxy serves as a wrapper for the actual storage engine instance. Each of these proxies extend StorageProxy.scala which is a parent abstract class. We then return this StorageProxy in StorageProxyFactory.scala. This factory selects the appropriate proxy to return by consulting the config file for the storage engine in use.

Ongoing Work

The team will be expanding on this factory pattern abstraction in the coming weeks/months. This will likely include more abstraction for other storage-related code as well as the introduction of Elasticsearch-specific code.