Skip to content

Latest commit

 

History

History
68 lines (45 loc) · 1.82 KB

overview-provider.md

File metadata and controls

68 lines (45 loc) · 1.82 KB

XVIZ Provider

XVIZ Providers encapsulate the details of reading a particular XVIZ source and returns an object that allows you to access metadata and iterate over the XVIZ messages.

Clients should not construct XVIZProviders directly, but instead use the XVIZProviderFactory to find create a Provider.

If a client has a custom XVIZ data source they can create their own Provider and register it with the factory.

Example

import {XVIZProviderFactory} from '@xviz/io';
import {FileSource} from '@xviz/io/node';

const root = '.';
const source = new FileSource(root);
const provider = await XVIZProviderFactory.open({
  source,
  root
});

if (provider) {
  // ...
}

Interface Methods

async init()

Attempts to verify if the source represents a valid XVIZ data source and sets the result from valid() appropriately.

This method must be called after construction before any other method.

valid()

Returns: (Boolean) - True if the source is a valid for this Provider

xvizMetadata()

Returns: the XVIZ Metadata if present

getMessageIterator(range, options)

Parameters:

  • range.startTime (Number, optional) - The start time to being interation. If absent, set to the start of the log.
  • range.endTime (Number, optional) - The end time to stop iteration. If absent, set to the end of the log.
  • options (Object) - Implementation defined.

Returns: (iterator) - iterator object for messages

xvizMessage(iterator)

Parameters:

Returns: (XVIZData) - object or null if the iterator is invalid