Class: Textus::Handlers::Read::PulseEntries

Inherits:
Object
  • Object
show all
Defined in:
lib/textus/handlers/read/pulse_entries.rb

Instance Method Summary collapse

Constructor Details

#initialize(manifest:, audit_log:, file_store:, orchestration:, job_store: nil) ⇒ PulseEntries

Returns a new instance of PulseEntries.



5
6
7
8
9
10
11
# File 'lib/textus/handlers/read/pulse_entries.rb', line 5

def initialize(manifest:, audit_log:, file_store:, orchestration:, job_store: nil)
  @manifest = manifest
  @audit_log = audit_log
  @file_store = file_store
  @orchestration = orchestration
  @job_store = job_store
end

Instance Method Details

#call(command, call) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/textus/handlers/read/pulse_entries.rb', line 13

def call(command, call)
  root  = @manifest.data.root
  since = command.since || Textus::Store::Cursor.new(root: root, role: call.role).read

  changed = changed_since(since, call)

  result = {
    "cursor" => @audit_log.latest_seq,
    "changed" => changed,
    "pending_review" => review_keys(call),
    "contract_etag" => Textus::Value::Etag.for_contract(root),
    "index_etag" => index_etag,
  }

  Textus::Store::Cursor.new(root: root, role: call.role).write(result["cursor"])
  Value::Result.success(result)
end