Class: Textus::Operations
- Inherits:
-
Object
- Object
- Textus::Operations
- Defined in:
- lib/textus/operations.rb,
lib/textus/operations/reads.rb,
lib/textus/operations/writes.rb,
lib/textus/operations/refresh.rb
Overview
Single canonical entrypoint for invoking application use-cases against a store. Mirrors the directory structure under ‘lib/textus/application/`:
ops = Textus::Operations.for(store, role: "agent")
ops.writes.put.call(key, body: "...")
ops.reads.get.call(key)
ops.refresh.worker.call(key)
Replaces the prior ‘Textus::Composition` module (deleted in v0.12.2).
Defined Under Namespace
Classes: Reads, Refresh, Writes
Instance Attribute Summary collapse
-
#ctx ⇒ Object
readonly
Returns the value of attribute ctx.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(ctx) ⇒ Operations
constructor
A new instance of Operations.
- #reads ⇒ Object
- #refresh ⇒ Object
- #with_role(role) ⇒ Object
- #writes ⇒ Object
Constructor Details
#initialize(ctx) ⇒ Operations
Returns a new instance of Operations.
24 25 26 |
# File 'lib/textus/operations.rb', line 24 def initialize(ctx) @ctx = ctx end |
Instance Attribute Details
#ctx ⇒ Object (readonly)
Returns the value of attribute ctx.
22 23 24 |
# File 'lib/textus/operations.rb', line 22 def ctx @ctx end |
Class Method Details
.for(store, role: Role::DEFAULT, correlation_id: nil, dry_run: false) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/textus/operations.rb', line 12 def self.for(store, role: Role::DEFAULT, correlation_id: nil, dry_run: false) ctx = Application::Context.new( store: store, role: role, correlation_id: correlation_id, dry_run: dry_run, ) new(ctx) end |
Instance Method Details
#reads ⇒ Object
32 33 34 |
# File 'lib/textus/operations.rb', line 32 def reads @reads ||= Reads.new(@ctx) end |
#refresh ⇒ Object
36 37 38 |
# File 'lib/textus/operations.rb', line 36 def refresh @refresh ||= Refresh.new(@ctx) end |
#with_role(role) ⇒ Object
40 41 42 |
# File 'lib/textus/operations.rb', line 40 def with_role(role) self.class.new(@ctx.with_role(role)) end |