core icon indicating copy to clipboard operation
core copied to clipboard

Allow some search in resettable streams

Open xivk opened this issue 6 years ago • 0 comments

Implement the option to mark a location in a source stream and the option to return to that location if the stream can be reset. An example of a possible API could be:

  • OsmStreamSource.NewHook() : Returns an object containing the information needed for the source to reset to the current location.
  • OsmStreamSource.MoveToHook(Hook h) : Seeks the stream to hook create in the call above.
  • OsmStreamSource.CanSeek : Returns true when the stream is seekable.

This allows OsmSharp to move to specific objects in source streams or to move to the first Node, Way or Relation in a stream without going over the entire stream again. Optionally, in sorted streams we can automatically create default hooks for the start of ways and relations, automatically exposing this functionality to any sorted stream.

These calls should throw exceptions when used on a non-seekable stream.

xivk avatar Nov 19 '18 15:11 xivk