Module: FastExists
- Defined in:
- lib/fast_exists.rb,
lib/fast_exists/cli.rb,
lib/fast_exists/engine.rb,
lib/fast_exists/errors.rb,
lib/fast_exists/railtie.rb,
lib/fast_exists/version.rb,
lib/fast_exists/bit_array.rb,
lib/fast_exists/bloom/filter.rb,
lib/fast_exists/backends/base.rb,
lib/fast_exists/backends/file.rb,
lib/fast_exists/backends/null.rb,
lib/fast_exists/configuration.rb,
lib/fast_exists/backends/redis.rb,
lib/fast_exists/bloom/counting.rb,
lib/fast_exists/bloom/scalable.rb,
lib/fast_exists/backends/memory.rb,
lib/fast_exists/backends/registry.rb,
lib/fast_exists/multi_tenant/base.rb,
lib/fast_exists/multi_tenant/pool.rb,
lib/fast_exists/intelligence/stats.rb,
lib/fast_exists/statistics/tracker.rb,
lib/fast_exists/active_record/hooks.rb,
lib/fast_exists/intelligence/doctor.rb,
lib/fast_exists/intelligence/health.rb,
lib/fast_exists/backends/redis_bloom.rb,
lib/fast_exists/intelligence/auditor.rb,
lib/fast_exists/optimizer/ai_advisor.rb,
lib/fast_exists/probabilistic/cuckoo.rb,
lib/fast_exists/intelligence/analyzer.rb,
lib/fast_exists/multi_tenancy/resolver.rb,
lib/fast_exists/multi_tenant/allocator.rb,
lib/fast_exists/active_record/extension.rb,
lib/fast_exists/intelligence/data_model.rb,
lib/fast_exists/intelligence/report/csv.rb,
lib/fast_exists/intelligence/report/pdf.rb,
lib/fast_exists/multi_tenant/key_layout.rb,
lib/fast_exists/intelligence/report/html.rb,
lib/fast_exists/intelligence/report/json.rb,
lib/fast_exists/intelligence/report/yaml.rb,
lib/fast_exists/instrumentation/prometheus.rb,
lib/fast_exists/active_record/model_methods.rb,
lib/fast_exists/intelligence/report/builder.rb,
lib/fast_exists/intelligence/report/console.rb,
lib/fast_exists/probabilistic/hyper_log_log.rb,
lib/fast_exists/generators/install_generator.rb,
lib/fast_exists/intelligence/report/markdown.rb,
lib/fast_exists/instrumentation/open_telemetry.rb,
lib/fast_exists/probabilistic/count_min_sketch.rb,
lib/fast_exists/instrumentation/event_subscriber.rb,
lib/fast_exists/multi_tenant/recommendation_engine.rb,
lib/fast_exists/multi_tenant/strategies/base_strategy.rb,
lib/fast_exists/multi_tenant/strategies/global_strategy.rb,
lib/fast_exists/multi_tenant/strategies/shared_strategy.rb,
lib/fast_exists/multi_tenant/strategies/adaptive_strategy.rb,
lib/fast_exists/multi_tenant/strategies/per_tenant_strategy.rb
Defined Under Namespace
Modules: ActiveRecord, Backends, Bloom, Generators, Instrumentation, Intelligence, MultiTenancy, MultiTenant, Optimizer, Probabilistic, Statistics
Classes: BackendError, BitArray, CLI, CapacityExceededError, Configuration, ConfigurationError, DashboardController, Engine, Error, InvalidArgumentError, Railtie, UnsupportedBackendError
Constant Summary
collapse
- VERSION =
"1.0.0"
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.start_time ⇒ Object
Returns the value of attribute start_time.
56
57
58
|
# File 'lib/fast_exists.rb', line 56
def start_time
@start_time
end
|
Class Method Details
.analyze!(target = nil, attribute = nil, models: nil, format: nil, output: nil) ⇒ Object
100
101
102
103
104
105
106
107
108
109
110
111
112
|
# File 'lib/fast_exists.rb', line 100
def analyze!(target = nil, attribute = nil, models: nil, format: nil, output: nil)
res = FastExists::Intelligence::Analyzer.analyze(target, attribute, models: models)
if format || output
fmt = format || :json
case fmt.to_sym
when :json then JSON.pretty_generate(res)
when :yaml then res.transform_keys(&:to_s).to_yaml
else res
end
else
res
end
end
|
.configuration ⇒ Object
58
59
60
|
# File 'lib/fast_exists.rb', line 58
def configuration
@configuration ||= Configuration.new
end
|
62
63
64
|
# File 'lib/fast_exists.rb', line 62
def configure
yield(configuration)
end
|
.doctor!(format: :console) ⇒ Object
.health! ⇒ Object
Performance Intelligence Suite Public API
.register_backend(name, klass) ⇒ Object
70
71
72
|
# File 'lib/fast_exists.rb', line 70
def register_backend(name, klass)
backends.register(name, klass)
end
|
.report!(format: :html, output: nil, include: nil, compare: nil) ⇒ Object
122
123
124
125
126
127
128
129
|
# File 'lib/fast_exists.rb', line 122
def report!(format: :html, output: nil, include: nil, compare: nil)
FastExists::Intelligence::Report::Builder.build(
format: format,
output: output,
include: include,
compare: compare
)
end
|
.reset_stats! ⇒ Object
86
87
88
|
# File 'lib/fast_exists.rb', line 86
def reset_stats!
stats_tracker.reset!
end
|
.stats(format: nil, **options) ⇒ Object
78
79
80
81
82
83
84
|
# File 'lib/fast_exists.rb', line 78
def stats(format: nil, **options)
if format
FastExists::Intelligence::Stats.render(format: format)
else
stats_tracker.snapshot
end
end
|
.uptime ⇒ Object
90
91
92
|
# File 'lib/fast_exists.rb', line 90
def uptime
(Time.now - @start_time).round
end
|