Package bw :: Package poseidon :: Module oceanclient :: Class OceanClient
[frames] | no frames]

Class OceanClient

object --+
         |
        OceanClient

This storage works based on records stored in a hashtable The id must be hashable Internally, there is a long list of records and an index table which contains references to where these records are

  1. Adding a new record * Write the record to the end of the record table * Hash the key and write the key-reference pair to the index list
  2. Removing a record * Remove the entry in the key-reference list (This should be a B-Tree)
  3. Modifying a record * Add the modified record to the end of the record table * Update the key-reference pair to the new reference * During packing, remove all unused items in the data table
  4. Transactions * During the transaction, everything is in memory * Only during the commit, stuff gets written to disk

Hence, each storage must have an index file and a data file During reads, first the whole index is read. Then the list of references are sorted before the data is read.

Multi Version Concurrency Control This is done as follows. At the start of a transaction, a copy of the index is made in thread local memory. The read time of the index is stored as well. During the transaction, this thread local version of the index is used. When the transaction commits, the thread local index is written to the global index (along with a write timestamp). However, if the write timestamp of the thread global index is > read timestamp of the thread local index, then the commit fails with a conflict error.

Instance Methods
 
__init__(self, fn, options)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
get_proxy(self)
 
__repr__(self)
repr(x)
 
__getitem__(self, key)
 
get(self, key, failobj=None)
 
__setitem__(self, key, v)
 
setdefault(self, key, failobj=None)
 
process_options(self, options)
 
close(self)
 
pack(self)
 
has_key(self, key)
 
__len__(self)
 
__contains__(self, key)
 
read(self, i)
 
put(self, i, data)
 
begin_transaction(self, c=None)
 
rollback(self, c=None)
Rollback the transaction
 
commit(self)
 
stats(self)

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

Properties

Inherited from object: __class__

Method Details

__init__(self, fn, options)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

__repr__(self)
(Representation operator)

 

repr(x)

Overrides: object.__repr__
(inherited documentation)