Introduce annotation to indicate when a DocIdStream implementation can be replayed
Description
Sometimes a DocIdStream can be replayed, e.g. RangeDocIdStream, there is not iterator state kept with the instance.
Proposal:
Introduce an annotation
@Retention(RetentionPolicy.RUNTIME)
public @interface Replayable {
}
To indicate a DocIdStream can be replayed.
Wouldn't an empty marker interface be easier to work with? Anyway, such changes should probably be motivated by something else, otherwise they lack the necessary context for saying if it's right or wrong.
Yup, empty marker interface does exactly the samething, annotation is just prettier and allows for future parameters support. But in this context, no difference.
DocIdStreams are like iterators, it can be only scanned through once. But nothing in the api that prohibits it to be reused.
If we were to pass the same DocIdStream to multiple aggregators, without knowing it can be replayed, it needs to be reconstructed.