Class: Textus::Operations

Inherits:
Object
  • Object
show all
Defined in:
lib/textus/operations.rb

Overview

Single canonical entrypoint for invoking application use-cases against a store. Public surface is flat — one method per use case:

ops = Textus::Operations.for(store, role: "agent")
ops.put(key, body: "...")
ops.get(key)               # pure read
ops.get_or_refresh(key)    # read + refresh-on-stale
ops.refresh(key)           # synchronous worker refresh
ops.refresh_all(prefix: ..., zone: ...)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#ctxObject (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

#acceptObject



34
# File 'lib/textus/operations.rb', line 34

def accept(...)  = accept_op.call(...)

#auditObject



50
# File 'lib/textus/operations.rb', line 50

def audit(...)           = audit_op.call(...)

#blameObject



51
# File 'lib/textus/operations.rb', line 51

def blame(...)           = blame_op.call(...)

#buildObject



36
# File 'lib/textus/operations.rb', line 36

def build(...)   = build_op.call(...)

#deleteObject



32
# File 'lib/textus/operations.rb', line 32

def delete(...)  = delete_op.call(...)

#depsObject



46
# File 'lib/textus/operations.rb', line 46

def deps(...)            = deps_op.call(...)

#freshnessObject



53
# File 'lib/textus/operations.rb', line 53

def freshness(...)       = freshness_op.call(...)

#getObject

reads



40
# File 'lib/textus/operations.rb', line 40

def get(...)             = get_op.call(...)

#get_or_refreshObject



41
# File 'lib/textus/operations.rb', line 41

def get_or_refresh(...)  = get_or_refresh_op.call(...)

#listObject



42
# File 'lib/textus/operations.rb', line 42

def list(...)            = list_op.call(...)

#mvObject



33
# File 'lib/textus/operations.rb', line 33

def mv(...)      = mv_op.call(...)

#policy_explainObject



52
# File 'lib/textus/operations.rb', line 52

def policy_explain(...)  = policy_explain_op.call(...)

#publishObject



37
# File 'lib/textus/operations.rb', line 37

def publish(...) = publish_op.call(...)

#publishedObject



48
# File 'lib/textus/operations.rb', line 48

def published(...)       = published_op.call(...)

#putObject

writes



31
# File 'lib/textus/operations.rb', line 31

def put(...)     = put_op.call(...)

#rdepsObject



47
# File 'lib/textus/operations.rb', line 47

def rdeps(...)           = rdeps_op.call(...)

#refresh(key) ⇒ Object

refresh



57
# File 'lib/textus/operations.rb', line 57

def refresh(key) = refresh_worker_op.run(key)

#refresh_allObject



58
# File 'lib/textus/operations.rb', line 58

def refresh_all(**) = Application::Refresh::All.call(@ctx, **)

#rejectObject



35
# File 'lib/textus/operations.rb', line 35

def reject(...)  = reject_op.call(...)

#schema_envelopeObject



45
# File 'lib/textus/operations.rb', line 45

def schema_envelope(...) = schema_envelope_op.call(...)

#staleObject



49
# File 'lib/textus/operations.rb', line 49

def stale(...)           = stale_op.call(...)

#uidObject



44
# File 'lib/textus/operations.rb', line 44

def uid(...)             = uid_op.call(...)

#validate_allObject



54
# File 'lib/textus/operations.rb', line 54

def validate_all(...)    = validate_all_op.call(...)

#whereObject



43
# File 'lib/textus/operations.rb', line 43

def where(...)           = where_op.call(...)

#with_role(role) ⇒ Object



28
# File 'lib/textus/operations.rb', line 28

def with_role(role) = self.class.new(@ctx.with_role(role))