Class Store
In: lib/storage/store.rb
Parent: Object
Store
dot/f_51.png

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

Methods

check   close   delete   each   get   getid   inspect   makenoswap   makeswap   mark   new   put   save   stats  

Public Class methods

Construct store

return
Handle to the store

[Source]

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

Public Instance methods

Check if an object is in the database by its id.

oid
is the id to use in the search.
return
true or false

[Source]

# File lib/storage/store.rb, line 93
  def check(oid)
    false
  end

Close the store

return
Undefined.

[Source]

# File lib/storage/store.rb, line 63
  def close
  end

Deletes an object from the database.

oid
is the id to to be deleted.
return
Undefined.

[Source]

# File lib/storage/store.rb, line 112
  def delete(oid)
  end

Iterate through all objects

yield
Each object in database to block of caller.

[Source]

# File lib/storage/store.rb, line 117
  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.

[Source]

# File lib/storage/store.rb, line 86
  def get(oid)
    nil
  end

Fetch the next available id.

return
An id.

[Source]

# File lib/storage/store.rb, line 79
  def getid
    @dbtop+=1
  end

inspect the store cache (only for caches)

return
Undefined.

[Source]

# File lib/storage/store.rb, line 68
  def inspect
    ""
  end

Marks an object nonswappable

oid
is the object id
return
undefined

[Source]

# File lib/storage/store.rb, line 123
  def makenoswap(oid)
  end

Marks an object swappable

oid
is the object id
return
undefined

[Source]

# File lib/storage/store.rb, line 129
  def makeswap(oid)
  end

Marks an object dirty

oid
is the id to use in the search.
return
undefined

[Source]

# File lib/storage/store.rb, line 100
  def mark(oid)
  end

Adds a new object to the database.

obj
is a reference to object to be added
return
Undefined.

[Source]

# File lib/storage/store.rb, line 106
  def put(obj)
  end

Save or flush the store to disk

return
Undefined.

[Source]

# File lib/storage/store.rb, line 74
  def save
  end

produces a statistical report of the database

return
a string containing the report

[Source]

# File lib/storage/store.rb, line 134
  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]\n---* Database Statistics *---\n  Rooms      - \#{rooms}\n  Objects    - \#{objs}\n  Scripts    - \#{scripts}\n  Accounts   - \#{accounts}\n  Characters - \#{characters}\n  Total Objects - \#{rooms+objs+characters+accounts+scripts}\n  Highest OID in use - \#{@dbtop}\n---*                     *---\n[/COLOR]\n"
  end

[Validate]