Part of bzrlib.index View In Hierarchy
Known subclasses: bzrlib.btree_index.BTreeBuilder, bzrlib.index.InMemoryGraphIndex
A builder that can build a GraphIndex.
The resulting graph has the structure:
_SIGNATURE OPTIONS NODES NEWLINE _SIGNATURE := 'Bazaar Graph Index 1' NEWLINE OPTIONS := 'node_ref_lists=' DIGITS NEWLINE NODES := NODE* NODE := KEY NULL ABSENT? NULL REFERENCES NULL VALUE NEWLINE KEY := Not-whitespace-utf8 ABSENT := 'a' REFERENCES := REFERENCE_LIST (TAB REFERENCE_LIST){node_ref_lists - 1} REFERENCE_LIST := (REFERENCE (CR REFERENCE)*)? REFERENCE := DIGITS ; digits is the byte offset in the index of the ; referenced key. VALUE := no-newline-no-null-bytes
Method | __init__ | Create a GraphIndex builder. |
Method | add_node | Add a node to the index. |
Method | clear_cache | See GraphIndex.clear_cache() |
Method | finish | Finish the index. |
Method | set_optimize | Change how the builder tries to optimize the result. |
Method | find_ancestry | See CombinedGraphIndex.find_ancestry() |
Method | _check_key | Raise BadIndexKey if key is not a valid key for this index. |
Method | _external_references | Return references that are not present in this index. |
Method | _get_nodes_by_key | Undocumented |
Method | _update_nodes_by_key | Update the _nodes_by_key dict with a new key. |
Method | _check_key_ref_value | Check that 'key' and 'references' are all valid. |
Parameters | reference_lists | The number of node references lists for each entry. |
key_elements | The number of bytestrings in each key. |
For a key of (foo, bar, baz) create _nodes_by_key[foo][bar][baz] = key_value
Parameters | key | A key tuple. Must conform to the key interface (be a tuple, be of the right length, not have any whitespace or nulls in any key element.) |
references | An iterable of reference lists. Something like [[(ref, key)], [(ref, key), (other, key)]] | |
value | The value associate with this key. Must not contain newlines or null characters. | |
Returns | (node_refs, absent_references)
|
Parameters | key | The key. keys are non-empty tuples containing as many whitespace-free utf8 bytestrings as the key length defined for this index. |
references | An iterable of iterables of keys. Each is a reference to another key. | |
value | The value to associate with the key. It may be any bytes as long as it does not contain 0 or n. |
This is a no-op, but we need the api to conform to a generic 'Index' abstraction.
Finish the index. :returns: cStringIO holding the full context of the index as it should be written to disk.
Parameters | for_size | Tell the builder to try and make the index as small as possible. |
combine_backing_indices | If the builder spills to disk to save memory, should the on-disk indices be combined. Set to True if you are going to be probing the index, but to False if you are not. (If you are not querying, then the time spent combining is wasted.) | |
Returns | None |