[Glass] Position method for BtreePlusReadStream classes

Dale Henrichs dale.henrichs at gemtalksystems.com
Mon Jun 8 12:18:08 PDT 2020


Bruno,

There is no backing collection for the BtreePlusReadStream, so being 
able to go to a certain position is not possible without counting....

We should be able to quickly produce a result set of the entire query 
results, but it would be a set not an ordered collection:( And to get 
results _in order_ the streaming API is the only solution... To get the 
kind of performance that you would want, I would think that it should be 
possible to create a primitive that would produce the result set in the 
form of an Array (in order) instead of a Set.

For now you would have to produce the Array yourself using:

    | result |
    result := {}.
    gsQuery do: [:each | result add: each]

#do: uses the BtreePlusReadStream api underneath covers, so the #do: 
elements are processed in order ...

Let me know if you you would need a primitive for performance and I can 
submit a feature request ...

Dale

On 6/8/20 11:53 AM, smalltalk--- via Glass wrote:
> Hi,
>
> aRcIdentitySet has an index on 'each.modifiedTime' and it can have a 
> lot of instances.
>
> In order to get a list of sorted instances (by modifiedTime) i do:
> |gsQuery|
> gsQuery := GsQuery fromString: 'each.modifiedTime <= timeNow'.
> gsQuery bind: 'timeNow' to: TimeStamp now.
> gsQuery on: aRcIdentitySet .
>
> Now i want to 'jump' to a given position in this stream...
> It is possible to use some kind of #position: message in 
> aBtreePlusReadStream ?
> (position: does no exist in BtreePlusReadStream)
>
> I could use #next to 'jump' to a given position, but the query can be 
> very very large.
> At the end it show a paging web page to a user that can click to get 
> the next bunch of objects.
> So i do not want to do #next over a large collection.
>
> regards,
> bruno
> 2.11.0.0
> 2.11.0.0
>
> _______________________________________________
> Glass mailing list
> Glass at lists.gemtalksystems.com
> https://lists.gemtalksystems.com/mailman/listinfo/glass
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gemtalksystems.com/mailman/private/glass/attachments/20200608/bd14fc22/attachment.htm>


More information about the Glass mailing list