Module: Woods::Storage::MetadataStore::Interface
Overview
Interface that all metadata store adapters must implement.
Instance Method Summary collapse
-
#count ⇒ Integer
Return the total number of stored units.
-
#delete(id) ⇒ Object
Delete a unit by ID.
-
#find(id) ⇒ Hash?
Find a unit by ID.
-
#find_batch(ids) ⇒ Hash<String, Hash>
Find multiple units by IDs in a single query.
-
#find_by_type(type) ⇒ Array<Hash>
Find all units of a given type.
-
#search(query, fields: nil) ⇒ Array<Hash>
Search metadata by text query across specified fields.
-
#store(id, metadata) ⇒ Object
Store or update metadata for a unit.
Instance Method Details
#count ⇒ Integer
Return the total number of stored units.
91 92 93 |
# File 'lib/woods/storage/metadata_store.rb', line 91 def count raise NotImplementedError end |
#delete(id) ⇒ Object
Delete a unit by ID.
83 84 85 |
# File 'lib/woods/storage/metadata_store.rb', line 83 def delete(id) raise NotImplementedError end |
#find(id) ⇒ Hash?
Find a unit by ID.
42 43 44 |
# File 'lib/woods/storage/metadata_store.rb', line 42 def find(id) raise NotImplementedError end |
#find_batch(ids) ⇒ Hash<String, Hash>
Find multiple units by IDs in a single query.
Default implementation falls back to individual find calls. Adapters should override for batch-optimized behavior.
53 54 55 56 57 58 |
# File 'lib/woods/storage/metadata_store.rb', line 53 def find_batch(ids) ids.each_with_object({}) do |id, result| data = find(id) result[id] = data if data end end |
#find_by_type(type) ⇒ Array<Hash>
Find all units of a given type.
65 66 67 |
# File 'lib/woods/storage/metadata_store.rb', line 65 def find_by_type(type) raise NotImplementedError end |
#search(query, fields: nil) ⇒ Array<Hash>
Search metadata by text query across specified fields.
75 76 77 |
# File 'lib/woods/storage/metadata_store.rb', line 75 def search(query, fields: nil) raise NotImplementedError end |
#store(id, metadata) ⇒ Object
Store or update metadata for a unit.
33 34 35 |
# File 'lib/woods/storage/metadata_store.rb', line 33 def store(id, ) raise NotImplementedError end |