Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

split node.slice into node.getByOrigin and node.iterate #397

Merged
merged 4 commits into from
Jan 12, 2023

Conversation

SergNikitin
Copy link
Collaborator

In its current form node.slice is difficult to implement for #351 because it exposes time-based query parameters such as start_time, end_time etc. These are easy to work with when there's access to SQL, but with a KV-storage the implementation has little choice but to

  1. either load all of the nodes into memory on every iter.next() or hold all the nodes in memory continuously until iterations are done
  2. raw loop over all of them

Luckily however none of the existing code really uses these time-based queries (except the internals of node.slice implementation). All uses of node.slice fall into one of two categories:

  1. either the calling code iterates over all nodes
  2. or the calling code wants to find nodes that have a specific OriginId

The first category doesn't leverage time-based parameters (calls look like node.slice({})). The second does specify them but not because it cares about time -- purely because this makes slice() emulate what they need.

This means that exposure of time-based params is not a necessity right now which allows to split it into two methods, one for each category. Resulting methods are easy to implement in a KV-storage context.

@SergNikitin SergNikitin mentioned this pull request Jan 11, 2023
8 tasks
@SergNikitin SergNikitin merged commit ce8140b into main Jan 12, 2023
@SergNikitin SergNikitin deleted the rm-unused-slice-features branch January 12, 2023 09:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants