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

Class BucketHandler

object --+
         |
        BucketHandler

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see help(type(x)) for signature
 
_needsBuckets(self)
Checks if all necearry buckets have been supplied and processed
 
getTreeLefts(self)
Returns the Radix Trie "left" pointers
 
getTreeRights(self)
Returns the Radix Trie "right" pointers
 
getTreeProperties(self)
Returns the properties used in the Radix Trie nodes
 
getPropertyNames(self)
Returns the property names array
 
getPropertyNamesAsStrings(self)
Returns the property names array
 
processBucket(self, bucketId, fileCrc32, bucketData)
Process a bucket identified by bucketId.
 
_processPropertyNamesBucket(self, data)
The following is the structure of this bucket :...
 
_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>
 
_getSingleValueProperty(self, reader)
Read a single-value property value
 
_getMultipleValueProperty(self, reader)
Read a multi-value property.
 
_processPropertiesBucket(self, data)
Properties - nameid:valueid The following is the structure of this bucket
 
_processIpv4TreeBucket(self, data)
Load the data for the IPv4 Tree bucket.
 
_getPropertyValue(self, dataType, reader)
Read the appropriate property from the ByteReader depending on the data type.

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 = u'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)

 

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

Overrides: object.__init__
(inherited documentation)

processBucket(self, bucketId, fileCrc32, bucketData)

 

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

_processPropertyNamesBucket(self, data)

 

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)

 

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)

 

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)

 

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)

 

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)

 

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.