Class: Manifold::Services::VectorService
- Inherits:
-
Object
- Object
- Manifold::Services::VectorService
- Defined in:
- lib/manifold/services/vector_service.rb
Overview
Handles the loading of vector schemas from configuration files
Instance Method Summary collapse
-
#initialize(logger) ⇒ VectorService
constructor
A new instance of VectorService.
- #load_vector_schema(vector_name) ⇒ Object
Constructor Details
#initialize(logger) ⇒ VectorService
Returns a new instance of VectorService.
7 8 9 |
# File 'lib/manifold/services/vector_service.rb', line 7 def initialize(logger) @logger = logger end |
Instance Method Details
#load_vector_schema(vector_name) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/manifold/services/vector_service.rb', line 11 def load_vector_schema(vector_name) path = config_path(vector_name) config = YAML.safe_load_file(path) fields = transform_attributes_to_schema(config["attributes"]) { "name" => vector_name.downcase, "type" => "RECORD", "fields" => fields } rescue Errno::ENOENT, Errno::EISDIR raise "Vector configuration not found: #{path}" rescue Psych::Exception => e raise "Invalid YAML in vector configuration #{path}: #{e.}" end |