Class: LS4::FileUpdateLog

Inherits:
UpdateLogService show all
Defined in:
lib/ls4/service/ulog_file.rb

Defined Under Namespace

Classes: Header, LogFile, Record, RecordRef

Constant Summary collapse

HEADER_SIZE =

File format: -------——--------—-…+— | 8 | 8 | 8 | 48 | records… -------——--------—-…+— magic “SoULog00”

start-timestamp
        pos
                reserved...

Record format: ------——-------... |vbcode|msgpack| raw | ------——-------... record-size

metadata
        data
|                 |
|-----------------|
    record-size
64
MAGICK =
"SoULog00"

Instance Method Summary collapse

Methods inherited from UpdateLogService

#shutdown

Methods inherited from Service

init

Methods included from EventBus::SingletonMixin

#ebus_bind!, #ebus_connect, extended

Methods included from EventBus::BusMixin

#ebus_all_slots, #ebus_disconnect!

Methods included from EventBus::DeclarerBase::Methods

#connect, #ebus_all_slots, #ebus_call_log, #ebus_call_slots, #ebus_signal_error, #ebus_signal_log, #ebus_signal_slots

Methods included from EventBus::DeclarerBase

#call_slot, #signal_slot

Instance Method Details

#append(data, &block) ⇒ Object



300
301
302
303
304
305
# File 'lib/ls4/service/ulog_file.rb', line 300

def append(data, &block)
	# FIXME rotation
	atime = next_time
	atime = @f.append(atime, data, &block)
	atime
end

#closeObject



296
297
298
# File 'lib/ls4/service/ulog_file.rb', line 296

def close
	@f.close
end

#get(pos) ⇒ Object



307
308
309
310
# File 'lib/ls4/service/ulog_file.rb', line 307

def get(pos)
	# FIXME rotation
	@f.get(pos)
end

#open(expr) ⇒ Object



289
290
291
292
293
294
# File 'lib/ls4/service/ulog_file.rb', line 289

def open(expr)
	@dir = expr
	atime = next_time
	# FIXME rotation
	@f = LogFile.new("#{@dir}/ulog-0000000001", atime)
end