Sha256: 84b44570b5d54ef6d08c1a50233f8051cd06fdebb472ce8dacf2c9134cdddc6a
Contents?: true
Size: 900 Bytes
Versions: 71
Compression:
Stored size: 900 Bytes
Contents
module ActiveFedora class UnsavedDigitalObject def assign_pid @pid ||= Sufia::IdService.mint end end class Base def stream Nest.new(self.class.name, $redis)[to_param] rescue nil end def self.stream Nest.new(name, $redis) rescue nil end def events(size=-1) stream[:event].lrange(0, size).map do |event_id| { action: $redis.hget("events:#{event_id}", "action"), timestamp: $redis.hget("events:#{event_id}", "timestamp") } end rescue [] end def create_event(action, timestamp) event_id = $redis.incr("events:latest_id") $redis.hmset("events:#{event_id}", "action", action, "timestamp", timestamp) event_id rescue nil end def log_event(event_id) stream[:event].lpush(event_id) rescue nil end end end
Version data entries
71 entries across 71 versions & 2 rubygems