Package mobi :: Package mtld :: Package da :: Package carrier :: Module bucket_handler :: Class BucketHandler
[hide private]
[frames] | no frames]

Class BucketHandler

source code

object --+
         |
        BucketHandler

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
_needsBuckets(self)
Checks if all necearry buckets have been supplied and processed
source code
 
getTreeLefts(self)
Returns the Radix Trie "left" pointers
source code
 
getTreeRights(self)
Returns the Radix Trie "right" pointers
source code
 
getTreeProperties(self)
Returns the properties used in the Radix Trie nodes
source code
 
getPropertyNames(self)
Returns the property names array
source code
 
getPropertyNamesAsStrings(self)
Returns the property names array
source code
 
processBucket(self, bucketId, fileCrc32, bucketData)
Process a bucket identified by bucketId.
source code
 
_processPropertyNamesBucket(self, data)
The following is the structure of this bucket :...
source code
 
_processPropertyValuesBucket(self, data)
The following is the structure of this bucket: 2b Number of indexed items <repeating> 1b container type ID: no container, ordered set etc <if container="no container"> 1B property type - int, boolean, string etc 1B/2B/4B length of value bytes --OPTIONAL-- (only applies to some string types) ?B the converted value, some data types have a fixed length such as (boolean len=1, byte len=1, short len=2, int len=4, float len=4) </if>
source code
 
_getSingleValueProperty(self, reader)
Read a single-value property value
source code
 
_getMultipleValueProperty(self, reader)
Read a multi-value property.
source code
 
_processPropertiesBucket(self, data)
Properties - nameid:valueid The following is the structure of this bucket
source code
 
_processIpv4TreeBucket(self, data)
Load the data for the IPv4 Tree bucket.
source code
 
_getPropertyValue(self, dataType, reader)
Read the appropriate property from the ByteReader depending on the data type.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  _NO_VALUE = -1
  _NO_CONTAINER = 0
  _ORDER_SET_CONTAINER = 1
  CRC32_DOES_NOT_MATCH = 'CRC-32 does not match for bucket "%s".'
  _property_names = None
hash(x)
  _propertyStringNames = None
hash(x)
  _propertyValues = None
hash(x)
  _properties = None
hash(x)
  _treeLefts = None
hash(x)
  _treeRights = None
hash(x)
  _treeProperties = None
hash(x)
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

processBucket(self, bucketId, fileCrc32, bucketData)

source code 

Process a bucket identified by bucketId. The bucket CRC-32 hash is verified before parsing the bucket data.

_processPropertyNamesBucket(self, data)

source code 

The following is the structure of this bucket :
2b Num of indexed items
<repeating>
    1b data type of property value
    1b length of name
    ?b property name - ascii string
</repeating>

_processPropertyValuesBucket(self, data)

source code 

The following is the structure of this bucket:
2b Number of indexed items
<repeating>
1b container type ID: no container, ordered set etc
      <if container="no container">
         1B        property type - int, boolean, string etc
         1B/2B/4B  length of value bytes --OPTIONAL-- (only applies to some string types)
         ?B        the converted value, some data types have a fixed length such as (boolean len=1, byte len=1, short len=2, int len=4, float len=4)
      </if>
  
      <elseif container="ordered set">
        1B   property type - int, boolean, string etc
        2B   number of items in the set
        <repeat>
          <if type=string>
            1B        property type - the type of string - 
            1B/2B/4B  length of value bytes --OPTIONAL-- (only applies to some string types)
          </if>
          ?B   the converted value, some data types have a fixed length such as (boolean len=1, byte len=1, short len=2, int len=4, float len=4)
        </repeat>
      </if>
</repeating>

_getMultipleValueProperty(self, reader)

source code 

Read a multi-value property. If the type is a string then the string type is read from the data file for each value in order to know how many bytes to read.

_processPropertiesBucket(self, data)

source code 

Properties - nameid:valueid
The following is the structure of this bucket

  
    The following is the structure of this bucket:
  
     2B   Num of indexed items
     <repeating>
         2B num items in collection
              <repeating>
         4B    property name ID
         4B    property value ID
         </repeating>
     </repeating>
  
  
    The order of the properties is taken as the index for each item. As each

_processIpv4TreeBucket(self, data)

source code 

Load the data for the IPv4 Tree bucket. This bucket has
the following structure:
  
    These 3 ints repeat for the entire bucket:
      <repeating>
         4B properties ID value
         4B Left value
         4B Right value
  </repeating>

_getPropertyValue(self, dataType, reader)

source code 

Read the appropriate property from the ByteReader depending on the data type. All of the primitive types are fixed length. In addition there are five fixed length UTF8 string values and other special types for strings that are less than certain lengths.