File Indexer

A FileIndexer is an object which keeps an index of series and blocks within series

class bosdyn.bddf.file_indexer.FileIndexer[source]

Bases: object

An object which keeps an index of series and blocks within series.

It can write a block index at the end of a data file.

property file_index

Get the FileIndex proto used which describes how to access data in the file.

property descriptor_index

Get the Descriptor proto containing the FileIndex.

property series_block_indexes

series_index -> SeriesBlockIndex.

Type:

Returns the current list of SeriesBlockIndexes

series_descriptor(series_index)[source]

Return SeriesDescriptor for given series index.

static series_identifier_to_hash(series_identifier)[source]

Given a SeriesIdentifier, return a 64-bit hash.

add_series_descriptor(series_descriptor, series_block_file_offset)[source]

Add the given series_descriptor to the index, with the given file offset.

Parameters:
  • index (series_descriptor SeriesDescriptor to add to the) –

  • written (series_block_file_offset Location in file where SeriesDescriptor will be) – was read from.

  • or – was read from.

add_series(series_type, series_spec, message_type, pod_type, annotations, additional_index_names, writer)[source]

Register a new series for messages for a DataWriter.

Parameters:
  • series_type – the kind of spec, corresponding to the set of keys expected in series_spec.

  • series_spec – dict of {key (string) -> value (string)} describing the series.

  • message_type – MessageTypeDescriptor (need EITHER this OR pod_type)

  • pod_type – PodTypeDescriptor (need EITHER this OR pod_type)

  • annotations – optional dict of key (string) -> value (string) pairs to associate with the message channel

  • additional_index_names – names of additional timestamps to store with each message (list of string).

  • writer – BlockWriter owned by the DataWriter.

Returns series id (int).

Raises SeriesNotUniqueError if a series matching series_spec is already added.

index_data_block(series_index, timestamp_nsec, file_offset, nbytes, additional_indexes)[source]

Add an entry to the data block index of the series identified by series_index.

make_data_descriptor(series_index, timestamp_nsec, additional_indexes)[source]

Return DataDescriptor for writing a data block, and add the block to the series index.

write_index(block_writer)[source]

Write all the indexes of the data file, and the file end.