Class: Mongoose::IDColumn
Overview
Instance Attribute Summary
#idx, #index_file_name
Attributes inherited from BaseColumn
#data_type, #name, #required, #tbl_class
Instance Method Summary
collapse
#close, #index_file_out_of_date?, #init_index, #with_index_file
Methods inherited from BaseColumn
#close, create, #indexed?, #required?, valid_data_type?
Constructor Details
#initialize(tbl_class, name, col_def) ⇒ IDColumn
Returns a new instance of IDColumn.
226
227
228
229
|
# File 'lib/mongoose/column.rb', line 226
def initialize(tbl_class, name, col_def)
@idx = {}
super
end
|
Instance Method Details
#add_index_rec(id, fpos) ⇒ Object
249
250
251
|
# File 'lib/mongoose/column.rb', line 249
def add_index_rec(id, fpos)
@idx[id] = fpos
end
|
#clear_index ⇒ Object
231
232
233
|
# File 'lib/mongoose/column.rb', line 231
def clear_index
@idx = {}
end
|
#rebuild_index_file ⇒ Object
235
236
237
|
# File 'lib/mongoose/column.rb', line 235
def rebuild_index_file
with_index_file('w') { |fptr| fptr.write(Marshal.dump(@idx)) }
end
|
#rebuild_index_from_index_file ⇒ Object
244
245
246
247
|
# File 'lib/mongoose/column.rb', line 244
def rebuild_index_from_index_file
clear_index
with_index_file { |fptr| @idx = Marshal.load(fptr) }
end
|
#rebuild_index_from_table ⇒ Object
239
240
241
242
|
# File 'lib/mongoose/column.rb', line 239
def rebuild_index_from_table
clear_index
@tbl_class.get_all_recs { |rec, fpos| add_index_rec(rec[0], fpos) }
end
|
#remove_index_rec(id) ⇒ Object
253
254
255
|
# File 'lib/mongoose/column.rb', line 253
def remove_index_rec(id)
@idx.delete(id)
end
|