The Store class is an abstract class defining the methods needed to access a data store
Construct store
return
Handle to the store
# File lib/storage/store.rb, line 56 def initialize @dbtop = 0 end
Check if an object is in the database by its id.
oid
is the id to use in the search.
return
true or false
# File lib/storage/store.rb, line 92 def check(oid) false end
Close the store
return
Undefined.
# File lib/storage/store.rb, line 62 def close end
Deletes an object from the database.
oid
is the id to to be deleted.
return
Undefined.
# File lib/storage/store.rb, line 111 def delete(oid) end
Iterate through all objects
yield
Each object in database to block of caller.
# File lib/storage/store.rb, line 116 def each end
Finds an object in the database by its id.
oid
is the id to use in the search.
return
Handle to the object or nil.
# File lib/storage/store.rb, line 85 def get(oid) nil end
Fetch the next available id.
return
An id.
# File lib/storage/store.rb, line 78 def getid @dbtop+=1 end
inspect the store cache (only for caches)
return
Undefined.
# File lib/storage/store.rb, line 67 def inspect "" end
Marks an object nonswappable
oid
is the object id
return
undefined
# File lib/storage/store.rb, line 122 def makenoswap(oid) end
Marks an object swappable
oid
is the object id
return
undefined
# File lib/storage/store.rb, line 128 def makeswap(oid) end
Marks an object dirty
oid
is the id to use in the search.
return
undefined
# File lib/storage/store.rb, line 99 def mark(oid) end
Adds a new object to the database.
obj
is a reference to object to be added
return
Undefined.
# File lib/storage/store.rb, line 105 def put(obj) end
Save or flush the store to disk
return
Undefined.
# File lib/storage/store.rb, line 73 def save end
produces a statistical report of the database
return
a string containing the report
# File lib/storage/store.rb, line 133 def stats rooms = objs = scripts = characters = accounts = 0 self.each do |val| case val when Room rooms += 1 when Character characters += 1 when GameObject objs += 1 when Script scripts += 1 when Account accounts += 1 end end stats="[COLOR Cyan] ---* Database Statistics *--- Rooms - #{rooms} Objects - #{objs} Scripts - #{scripts} Accounts - #{accounts} Characters - #{characters} Total Objects - #{rooms+objs+characters+accounts+scripts} Highest OID in use - #{@dbtop} ---* *--- [/COLOR] " end