Class: LlmCostTracker::Storage::CustomBackend

Inherits:
Object
  • Object
show all
Defined in:
lib/llm_cost_tracker/storage/custom_backend.rb

Class Method Summary collapse

Class Method Details

.save(event) ⇒ Object



9
10
11
12
# File 'lib/llm_cost_tracker/storage/custom_backend.rb', line 9

def save(event)
  result = LlmCostTracker.configuration.custom_storage&.call(event)
  result == false ? false : event
end

.verifyObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/llm_cost_tracker/storage/custom_backend.rb', line 14

def verify
  if LlmCostTracker.configuration.custom_storage.respond_to?(:call)
    return [
      VerificationResult.new(
        :ok,
        "storage",
        "custom storage callable configured; external sink was not invoked"
      )
    ]
  end

  [
    VerificationResult.new(:error, "storage", "custom storage backend requires config.custom_storage")
  ]
end