class Store

The Store class is an abstract class defining the methods needed to access a data store

Public Class Methods

new() click to toggle source

Construct store

return

Handle to the store

# File lib/storage/store.rb, line 56
def initialize
  @dbtop = 0
end

Public Instance Methods

check(oid) click to toggle source

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() click to toggle source

Close the store

return

Undefined.

# File lib/storage/store.rb, line 62
def close
end
delete(oid) click to toggle source

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
each() click to toggle source

Iterate through all objects

yield

Each object in database to block of caller.

# File lib/storage/store.rb, line 116
def each
end
get(oid) click to toggle source

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
getid() click to toggle source

Fetch the next available id.

return

An id.

# File lib/storage/store.rb, line 78
def getid
  @dbtop+=1
end
inspect() click to toggle source

inspect the store cache (only for caches)

return

Undefined.

# File lib/storage/store.rb, line 67
def inspect
  ""
end
makenoswap(oid) click to toggle source

Marks an object nonswappable

oid

is the object id

return

undefined

# File lib/storage/store.rb, line 122
def makenoswap(oid)
end
makeswap(oid) click to toggle source

Marks an object swappable

oid

is the object id

return

undefined

# File lib/storage/store.rb, line 128
def makeswap(oid)
end
mark(oid) click to toggle source

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
put(obj) click to toggle source

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() click to toggle source

Save or flush the store to disk

return

Undefined.

# File lib/storage/store.rb, line 73
def save
end
stats() click to toggle source

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