Package twisted :: Package world :: Module allocator :: Class FragmentFile
[frames | no frames]

Class FragmentFile

object --+    
         |    
  Storable --+
             |
            FragmentFile


Method Summary
  __init__(self, db)
  __awake__(self)
POSSIBLY: a method for when objects 'wake up'
  __finalizers__(self)
  _findOIDIndex(self, oid)
  findSpace(self, oid, sz)
Allocate the given number of bytes.
  free(self, oid, offset, sz, dx)
  getDataFile(self)
Bind datafile to me and return it.
  overlapSanityCheck(self)
  packFragments(self, begin)
Pack my fragment-space starting with a recently-freed fragment.
  reallocateSpace(self, oid, begin, oldSize, newSize, allocIndex)
Attempt to expand some already-allocated space forwards (move its end to a higher location in the file).
    Inherited from Storable
  __new__(klazz, *args, **kwargs)
(Static method)
  __repr__(self)
  _clearcache(self)
  _loadattr(self, attr)
  _saveattr(self, attr, val)
  _upgradeFrom(self, version, input)
  fromDB(klass, table, oid, genhash)
(Class method)
  getDatabase(self)
Get the database that this object is a member of.
  keepAlive(self, volatileObject)
Keep me alive until nobody references volatileObject any more.
  storedUIDPath(self)
    Inherited from object
  __delattr__(...)
  __getattribute__(...)
  __hash__(...)
  __reduce__(...)
  __setattr__(...)
  __str__(...)

Property Summary
  _schema_genhash: int(_schema_genhash)
  _schema_oid: int(_schema_oid)
  allocCount: int(allocCount)
  fileSize: int(fileSize)
  fragmentCount: int(fragmentCount)
  longestFragment: int(longestFragment)
  maxAllocs: int(maxAllocs)

Class Variable Summary
str __name__ = 'FragmentFile'
dict __schema__ = {'allocs': None, 'fragments': None, '_attrc...
NoneType _attrcache = None                                                                  
NoneType _inmem_fromdb = None                                                                  
NoneType _inmem_genhash = None                                                                  
NoneType _inmem_oid = None                                                                  
dict _schema_loadmap = {'fragmentCount': 4, 'fileSize': 3, 'a...
dict _schema_orig = {'allocs': None, 'datafile': None, 'fileS...
tuple _schema_storeorder = ('_schema_genhash', '_schema_oid', ...
NoneType _schema_table = None                                                                  
NoneType allocs = None                                                                  
NoneType datafile = None                                                                  
NoneType fragments = None                                                                  

Instance Method Details

__awake__(self)

POSSIBLY: a method for when objects 'wake up'
Overrides:
twisted.world.storable.Storable.__awake__ (inherited documentation)

findSpace(self, oid, sz)

Allocate the given number of bytes. If I can do it, return an (offset,actual) pair that is an offset into me and the amount of actual space allocated. This may be more than requested. The given OID in the same database as me is assumed to own this data chunk and may be asked to relocate it with the 'relocate' method.

If I can't, return None.

getDataFile(self)

Bind datafile to me and return it.

This makes it so that I do not accidentally go away while others are still holding references to my datafile.

packFragments(self, begin)

Pack my fragment-space starting with a recently-freed fragment.

reallocateSpace(self, oid, begin, oldSize, newSize, allocIndex)

Attempt to expand some already-allocated space forwards (move its end to a higher location in the file). This means we have to either find a fragment that's bumping up against the beginning or end of the already-allocated space, or the already-allocated space is touching the end of the file. If my attempt to request more space was successful, I will return the allocated size, otherwise, None.

Property Details

_schema_genhash

int(_schema_genhash)
Get Method:
getter(...)
Set Method:
setter(...)

_schema_oid

int(_schema_oid)
Get Method:
getter(...)
Set Method:
setter(...)

allocCount

int(allocCount)
Get Method:
getter(...)
Set Method:
setter(...)

fileSize

int(fileSize)
Get Method:
getter(...)
Set Method:
setter(...)

fragmentCount

int(fragmentCount)
Get Method:
getter(...)
Set Method:
setter(...)

longestFragment

int(longestFragment)
Get Method:
getter(...)
Set Method:
setter(...)

maxAllocs

int(maxAllocs)
Get Method:
getter(...)
Set Method:
setter(...)

Class Variable Details

__name__

Type:
str
Value:
'FragmentFile'                                                         

__schema__

Type:
dict
Value:
{'_attrcache': None,
 '_inmem_fromdb': None,
 '_inmem_genhash': None,
 '_inmem_oid': None,
 '_schema_genhash': <type 'int'>,
 '_schema_oid': <type 'int'>,
 '_schema_table': None,
 'allocCount': <type 'int'>,
...                                                                    

_attrcache

Type:
NoneType
Value:
None                                                                  

_inmem_fromdb

Type:
NoneType
Value:
None                                                                  

_inmem_genhash

Type:
NoneType
Value:
None                                                                  

_inmem_oid

Type:
NoneType
Value:
None                                                                  

_schema_loadmap

Type:
dict
Value:
{'_schema_genhash': 0,
 '_schema_oid': 1,
 'allocCount': 2,
 'fileSize': 3,
 'fragmentCount': 4,
 'longestFragment': 5,
 'maxAllocs': 6}                                                       

_schema_orig

Type:
dict
Value:
{'allocCount': <type 'int'>,
 'allocs': None,
 'datafile': None,
 'fileSize': <type 'int'>,
 'fragmentCount': <type 'int'>,
 'fragments': None,
 'longestFragment': <type 'int'>,
 'maxAllocs': <type 'int'>}                                            

_schema_storeorder

Type:
tuple
Value:
('_schema_genhash',
 '_schema_oid',
 'allocCount',
 'fileSize',
 'fragmentCount',
 'longestFragment',
 'maxAllocs')                                                          

_schema_table

Type:
NoneType
Value:
None                                                                  

allocs

Type:
NoneType
Value:
None                                                                  

datafile

Type:
NoneType
Value:
None                                                                  

fragments

Type:
NoneType
Value:
None                                                                  

Generated by Epydoc 2.0 on Sat Sep 13 04:20:43 2003 http://epydoc.sf.net