Class: Sequel::SchemaSharding::DTraceProvider
- Inherits:
-
Object
- Object
- Sequel::SchemaSharding::DTraceProvider
- Defined in:
- lib/sequel/schema-sharding/dtrace_provider.rb
Instance Attribute Summary collapse
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ DTraceProvider
constructor
A new instance of DTraceProvider.
- #read_only_shard_for ⇒ Object
- #replica_hash_for ⇒ Object
- #shard_for ⇒ Object
Constructor Details
#initialize ⇒ DTraceProvider
Returns a new instance of DTraceProvider.
8 9 10 |
# File 'lib/sequel/schema-sharding/dtrace_provider.rb', line 8 def initialize @provider = USDT::Provider.create(:ruby, :sequel_schema_sharding) end |
Instance Attribute Details
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
6 7 8 |
# File 'lib/sequel/schema-sharding/dtrace_provider.rb', line 6 def provider @provider end |
Class Method Details
.provider ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/sequel/schema-sharding/dtrace_provider.rb', line 24 def self.provider @provider ||= new.tap do |p| p.read_only_shard_for p.replica_hash_for p.shard_for p.provider.enable end end |
Instance Method Details
#read_only_shard_for ⇒ Object
12 13 14 |
# File 'lib/sequel/schema-sharding/dtrace_provider.rb', line 12 def read_only_shard_for @read_only_probe ||= provider.probe(:model, :read_only_shard_for, :string, :integer, :string) end |
#replica_hash_for ⇒ Object
16 17 18 |
# File 'lib/sequel/schema-sharding/dtrace_provider.rb', line 16 def replica_hash_for @replica_hash_for ||= provider.probe(:connection_manager, :replica_hash_for, :string) end |
#shard_for ⇒ Object
20 21 22 |
# File 'lib/sequel/schema-sharding/dtrace_provider.rb', line 20 def shard_for @shard_for_probe ||= provider.probe(:model, :shard_for, :string, :integer, :string) end |