class Flor::Timer

Public Instance Methods

fei() click to toggle source

create_table :flor_timers do

primary_key :id, type: :Integer
String :domain, null: false
String :exid, null: false
String :nid, null: false
String :type, null: false # 'at', 'in', 'cron', 'every', ...
String :schedule, null: false # '20141128.103239' or '00 23 * * *'
String :ntime # next time
File :content # JSON msg to trigger
Integer :count, null: false
String :status, null: false
String :ctime, null: false
String :mtime, null: false
String :cunit
String :munit
String :onid, null: false
String :bnid, null: false

index :exid
index [ :exid, :nid ]

end

# File lib/flor/unit/models/timer.rb, line 30
def fei; [ exid, nid ].join('-'); end
ntime_t() click to toggle source
# File lib/flor/unit/models/timer.rb, line 52
def ntime_t

  @ntime_t ||= Time.parse(ntime)
end
to_trigger_message() click to toggle source
# File lib/flor/unit/models/timer.rb, line 32
def to_trigger_message

  d = self.data(false)

  m = d['message']
  m['timer_id'] = self.id

  sm = d['m']

  { 'point' => 'trigger',
    'exid' => self.exid,
    'nid' => self.onid,
    'bnid' => self.nid,
    'type' => self.type,
    'schedule' => self.schedule,
    'timer_id' => self.id,
    'message' => m,
    'sm' => sm }
end